Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

fix duplicate compute on maxUnpatchedValue (#2106)

gf21212da3d1fef45c
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene84/PForUtil.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene84/PForUtil.java
index 81fab5ec988..ad0d6006fc5 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene84/PForUtil.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene84/PForUtil.java
@@ -71,7 +71,7 @@ final class PForUtil {
if (numExceptions > 0) {
int exceptionCount = 0;
for (int i = 0; i < ForUtil.BLOCK_SIZE; ++i) {
- if (longs[i] > (1L << patchedBitsRequired) - 1) {
+ if (longs[i] > maxUnpatchedValue) {
exceptions[exceptionCount*2] = (byte) i;
exceptions[exceptionCount*2+1] = (byte) (longs[i] >>> patchedBitsRequired);
longs[i] &= maxUnpatchedValue;