MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cirbuf_align_right

Function cirbuf_align_right

dpdk/lib/cmdline/cmdline_cirbuf.c:205–223  ·  view source on GitHub ↗

XXX we could do a better algorithm here... */

Source from the content-addressed store, hash-verified

203
204/* XXX we could do a better algorithm here... */
205int
206cirbuf_align_right(struct cirbuf * cbuf)
207{
208 if (!cbuf)
209 return -EINVAL;
210
211 if (cbuf->start >= cbuf->maxlen/2) {
212 while (cbuf->end != cbuf->maxlen-1) {
213 __cirbuf_shift_left(cbuf);
214 }
215 }
216 else {
217 while (cbuf->start != cbuf->maxlen-1) {
218 __cirbuf_shift_right(cbuf);
219 }
220 }
221
222 return 0;
223}
224
225/* buffer del */
226

Callers 2

test_cirbuf_align_rightFunction · 0.85

Calls 2

__cirbuf_shift_leftFunction · 0.85
__cirbuf_shift_rightFunction · 0.85

Tested by 2

test_cirbuf_align_rightFunction · 0.68