prevent (ub+lb) overflow
This commit is contained in:
parent
b21444d29d
commit
85771ea74f
@ -23,7 +23,7 @@ class BinarySearch
|
||||
if ( lb > ub)
|
||||
return -1;
|
||||
|
||||
int mid = (ub+lb)/2;
|
||||
int mid = (ub+lb) >>> 1;
|
||||
int comp = key.compareTo(array[mid]);
|
||||
|
||||
if (comp < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user