Lines Matching refs:hi
56 int hi;
75 hi = bb->count;
77 /* Binary search between lo and hi for 'target'
80 /* INVARIANT: ranges before 'lo' and at-or-after 'hi'
82 * VARIANT: hi-lo is the number of possible
85 while (hi - lo > 1) {
86 int mid = (lo + hi) / 2;
96 hi = mid;
98 /* 'lo' might be the last that started before target, but 'hi' isn't */
99 if (hi > lo) {
166 int lo, hi;
188 hi = bb->count;
190 while (hi - lo > 1) {
191 int mid = (lo + hi) / 2;
197 hi = mid;
199 if (hi > lo && BB_OFFSET(p[lo]) > s)
200 hi = lo;
202 if (hi > lo) {
234 if (sectors && hi < bb->count) {
235 /* 'hi' points to the first range that starts after 's'.
238 sector_t a = BB_OFFSET(p[hi]);
239 sector_t e = a + BB_LEN(p[hi]);
240 int ack = BB_ACK(p[hi]);
253 p[hi] = BB_MAKE(a, e-a, ack);
256 p[hi] = BB_MAKE(a, BB_MAX_LEN, ack);
260 lo = hi;
261 hi++;
264 if (sectors == 0 && hi < bb->count) {
265 /* we might be able to combine lo and hi */
267 sector_t a = BB_OFFSET(p[hi]);
269 int hilen = BB_LEN(p[hi]);
274 int ack = BB_ACK(p[lo]) && BB_ACK(p[hi]);
277 memmove(p + hi, p + hi + 1,
278 (bb->count - hi - 1) * 8);
284 * Need to add a range just before 'hi'
293 memmove(p + hi + 1, p + hi,
294 (bb->count - hi) * 8);
299 p[hi] = BB_MAKE(s, this_sectors, acknowledged);
333 int lo, hi;
353 hi = bb->count;
355 while (hi - lo > 1) {
356 int mid = (lo + hi) / 2;
362 hi = mid;
364 if (hi > lo) {
389 hi = lo;
407 /* 'lo' is strictly before, 'hi' is strictly after,
410 if (hi - lo > 1) {
411 memmove(p+lo+1, p+hi, (bb->count - hi) * 8);
412 bb->count -= (hi - lo - 1);