HBASE-20928 Rewrite calculation of midpoint - addemdum

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Xu Cang 2018-07-24 11:37:21 -07:00 committed by tedyu
parent 3b84c9c8d2
commit 1e167e4e2e
1 changed files with 1 additions and 1 deletions

View File

@ -2068,7 +2068,7 @@ public class Bytes implements Comparable<Bytes> {
int high = arr.length - 1; int high = arr.length - 1;
KeyValue.KeyOnlyKeyValue r = new KeyValue.KeyOnlyKeyValue(); KeyValue.KeyOnlyKeyValue r = new KeyValue.KeyOnlyKeyValue();
while (low <= high) { while (low <= high) {
int mid = (low+high) >>> 1; int mid = low + ((high - low) >> 1);
// we have to compare in this order, because the comparator order // we have to compare in this order, because the comparator order
// has special logic when the 'left side' is a special key. // has special logic when the 'left side' is a special key.
r.setKey(arr[mid], 0, arr[mid].length); r.setKey(arr[mid], 0, arr[mid].length);