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


##########
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:
   Will move this to a new method and add more tests around this.



-- 
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