Fix test failure

This commit is contained in:
Adrien Grand 2024-12-23 15:38:54 +01:00
parent 1720dc065d
commit 0f5943e19d
1 changed files with 16 additions and 2 deletions

View File

@ -342,7 +342,7 @@ public final class FixedBitSet extends BitSet {
// TODO: implement DocBaseBitSetIterator#intoBitSet instead // TODO: implement DocBaseBitSetIterator#intoBitSet instead
checkUnpositioned(iter); checkUnpositioned(iter);
DocBaseBitSetIterator baseIter = (DocBaseBitSetIterator) iter; DocBaseBitSetIterator baseIter = (DocBaseBitSetIterator) iter;
orRange(baseIter.getBitSet(), baseIter.getDocBase()); or(baseIter.getDocBase() >> 6, baseIter.getBitSet());
} else { } else {
checkUnpositioned(iter); checkUnpositioned(iter);
iter.nextDoc(); 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} * 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) { void orRange(FixedBitSet other, int from) {
int numBits = Math.min(length(), other.length() - from); int numBits = Math.min(length(), other.length() - from);