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


##########
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:
   @benwtrent Seems we don't have any test covering this "fast path".
   Firstly I have moved this logic under FixedBitSet. And then added tests for 
FixedBitSet, one specifically testing the scenario where the mask spans two 
long words.
   
   One high level in TestSkipBlockRangeIteratorIntoBitSet to test compare slow 
and fast path



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