Skip to content

Commit 812399e

Browse files
committed
Corrected error in prefixBinarySearch
There were an obvious mistake in the calculation of the middle for the binary search. (stopIndex + stopIndex) / 2 will evualuate to stopIndex and not to the arithmetic middle as intended.
1 parent ab69386 commit 812399e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins-client/ext.codecomplete/complete_util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function prefixBinarySearch(items, prefix) {
3838
else if (prefix > items[middle]) {
3939
startIndex = middle + 1;
4040
}
41-
middle = Math.floor((stopIndex + stopIndex) / 2);
41+
middle = Math.floor((stopIndex + startIndex) / 2);
4242
}
4343

4444
// Look back to make sure we haven't skipped any

0 commit comments

Comments
 (0)