prevent (ub+lb) overflow

This commit is contained in:
feng liu 2017-10-01 17:26:05 -06:00 committed by GitHub
parent b21444d29d
commit 85771ea74f

View File

@ -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)