benwtrent commented on code in PR #16123:
URL: https://github.com/apache/lucene/pull/16123#discussion_r3303535714


##########
lucene/core/src/java25/org/apache/lucene/internal/vectorization/PanamaDocValuesRangeSupport.java:
##########
@@ -58,10 +58,14 @@ public void rangeIntoBitSet(
       long maskBits = inRange.toLong();
       if (maskBits != 0) {
         int base = d - offset;
-        while (maskBits != 0) {
-          int bit = Long.numberOfTrailingZeros(maskBits);
-          bitSet.set(base + bit);
-          maskBits &= maskBits - 1;
+        int wordIndex = base >> 6;
+        int bitOffset = base & 63;
+        long[] bits = bitSet.getBits();
+        if (bitOffset + vectorLen <= 64) {
+          bits[wordIndex] |= maskBits << bitOffset;
+        } else {
+          bits[wordIndex] |= maskBits << bitOffset;
+          bits[wordIndex + 1] |= maskBits >>> (64 - bitOffset);

Review Comment:
   my main concern here is correctness. I don't remember from the previous PR, 
but do we have a test that takes random docs of various densities, etc. and 
ensures that the "slow iterative path" and "fast path" produce the exact same 
results?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to