mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Merge pull request #10275 from Snuffleupagus/trees-get-binary-search
Fix `NameOrNumberTree.get` to actually perform a binary search to find the requested key
This commit is contained in:
commit
87e3fb8413
1 changed files with 1 additions and 1 deletions
|
@ -1686,7 +1686,7 @@ class NameOrNumberTree {
|
|||
while (l <= r) {
|
||||
// Check only even indices (0, 2, 4, ...) because the
|
||||
// odd indices contain the actual data.
|
||||
const m = (l + r) & ~1;
|
||||
const tmp = (l + r) >> 1, m = tmp + (tmp & 1);
|
||||
const currentKey = xref.fetchIfRef(entries[m]);
|
||||
if (key < currentKey) {
|
||||
r = m - 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue