Lines Matching refs:hi
56 int hi;
76 hi = bb->count;
78 /* Binary search between lo and hi for 'target'
81 /* INVARIANT: ranges before 'lo' and at-or-after 'hi'
83 * VARIANT: hi-lo is the number of possible
86 while (hi - lo > 1) {
87 int mid = (lo + hi) / 2;
97 hi = mid;
99 /* 'lo' might be the last that started before target, but 'hi' isn't */
100 if (hi > lo) {
167 int lo, hi;
189 hi = bb->count;
191 while (hi - lo > 1) {
192 int mid = (lo + hi) / 2;
198 hi = mid;
200 if (hi > lo && BB_OFFSET(p[lo]) > s)
201 hi = lo;
203 if (hi > lo) {
235 if (sectors && hi < bb->count) {
236 /* 'hi' points to the first range that starts after 's'.
239 sector_t a = BB_OFFSET(p[hi]);
240 sector_t e = a + BB_LEN(p[hi]);
241 int ack = BB_ACK(p[hi]);
254 p[hi] = BB_MAKE(a, e-a, ack);
257 p[hi] = BB_MAKE(a, BB_MAX_LEN, ack);
261 lo = hi;
262 hi++;
265 if (sectors == 0 && hi < bb->count) {
266 /* we might be able to combine lo and hi */
268 sector_t a = BB_OFFSET(p[hi]);
270 int hilen = BB_LEN(p[hi]);
275 int ack = BB_ACK(p[lo]) && BB_ACK(p[hi]);
278 memmove(p + hi, p + hi + 1,
279 (bb->count - hi - 1) * 8);
285 * Need to add a range just before 'hi'
294 memmove(p + hi + 1, p + hi,
295 (bb->count - hi) * 8);
300 p[hi] = BB_MAKE(s, this_sectors, acknowledged);
334 int lo, hi;
355 hi = bb->count;
357 while (hi - lo > 1) {
358 int mid = (lo + hi) / 2;
364 hi = mid;
366 if (hi > lo) {
391 hi = lo;
409 /* 'lo' is strictly before, 'hi' is strictly after,
412 if (hi - lo > 1) {
413 memmove(p+lo+1, p+hi, (bb->count - hi) * 8);
414 bb->count -= (hi - lo - 1);