HBASE-20928 Rewrite calculation of midpoint - addemdum
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
3b84c9c8d2
commit
1e167e4e2e
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue