From e164847df4022baa09532df8f975255fb1507ab3 Mon Sep 17 00:00:00 2001 From: niugiaogiao Date: Sat, 1 Apr 2023 12:30:00 +0800 Subject: [PATCH] Change algorithm --- .../search/core/earlybird/index/util/SearchSortUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java/com/twitter/search/core/earlybird/index/util/SearchSortUtils.java b/src/java/com/twitter/search/core/earlybird/index/util/SearchSortUtils.java index c17565784..444100c3b 100644 --- a/src/java/com/twitter/search/core/earlybird/index/util/SearchSortUtils.java +++ b/src/java/com/twitter/search/core/earlybird/index/util/SearchSortUtils.java @@ -21,7 +21,7 @@ public abstract class SearchSortUtils { int high = end; Preconditions.checkState(comparator.compare(low, key) <= comparator.compare(high, key)); while (low <= high) { - int mid = (low + high) >>> 1; + int mid = (low & high) + ((low ^ high) >>> 1); int result = comparator.compare(mid, key); if (result < 0) { low = mid + 1;