From 0f5943e19d0d0d61b8bf3d5cfcdd355417d7984d Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Mon, 23 Dec 2024 15:38:54 +0100 Subject: [PATCH] Fix test failure --- .../org/apache/lucene/util/FixedBitSet.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java b/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java index d65b241d594..584f30b3baa 100644 --- a/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java +++ b/lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java @@ -342,7 +342,7 @@ public final class FixedBitSet extends BitSet { // TODO: implement DocBaseBitSetIterator#intoBitSet instead checkUnpositioned(iter); DocBaseBitSetIterator baseIter = (DocBaseBitSetIterator) iter; - orRange(baseIter.getBitSet(), baseIter.getDocBase()); + or(baseIter.getDocBase() >> 6, baseIter.getBitSet()); } else { checkUnpositioned(iter); iter.nextDoc(); @@ -350,9 +350,23 @@ public final class FixedBitSet extends BitSet { } } + private void or(final int otherOffsetWords, FixedBitSet other) { + or(otherOffsetWords, other.bits, other.numWords); + } + + private void or(final int otherOffsetWords, final long[] otherArr, final int otherNumWords) { + assert otherNumWords + otherOffsetWords <= numWords + : "numWords=" + numWords + ", otherNumWords=" + otherNumWords; + int pos = Math.min(numWords - otherOffsetWords, otherNumWords); + final long[] thisArr = this.bits; + while (--pos >= 0) { + thisArr[pos + otherOffsetWords] |= otherArr[pos]; + } + } + /** * Or {@code min(length(), other.length() - from} bits starting at {@code from} from {@code other} - * into this bit set. + * into this bit set starting at 0. */ void orRange(FixedBitSet other, int from) { int numBits = Math.min(length(), other.length() - from);