Fix binary search when search value is in the last block, but not equal
to the start of the range. PR 49444.
This commit is contained in:
parent
490187770a
commit
e9d4ea8b6a
|
@ -263,21 +263,19 @@ public:
|
|||
|
||||
pint_t base = n->hdr_base;
|
||||
pint_t first = n->hdr_start;
|
||||
pint_t len = n->hdr_entries;
|
||||
while (len) {
|
||||
pint_t next = first + ((len + 1) / 2) * 8;
|
||||
for (pint_t len = n->hdr_entries; len > 1; ) {
|
||||
pint_t next = first + (len / 2) * 8;
|
||||
pint_t nextPC = base + (int32_t)get32(next);
|
||||
if (nextPC == pc) {
|
||||
first = next;
|
||||
break;
|
||||
}
|
||||
if (nextPC < pc) {
|
||||
len -= (len + 1) / 2;
|
||||
first = next;
|
||||
} else if (len == 1)
|
||||
break;
|
||||
else
|
||||
len = (len + 1) / 2;
|
||||
len -= (len / 2);
|
||||
} else {
|
||||
len /= 2;
|
||||
}
|
||||
}
|
||||
fdeStart = base + (int32_t)get32(first + 4);
|
||||
data_base = n->data_base;
|
||||
|
|
Loading…
Reference in New Issue