epotyom commented on code in PR #13559: URL: https://github.com/apache/lucene/pull/13559#discussion_r1697616026
########## lucene/core/src/java/org/apache/lucene/util/SparseFixedBitSet.java: ########## @@ -353,14 +355,47 @@ public int nextSetBit(int i) { final long indexBits = index >>> i64 >>> 1; if (indexBits == 0) { // no more bits are set in the current block of 4096 bits, go to the next one - return firstDoc(i4096 + 1); + return firstDoc(i4096 + 1, indices.length); } // there are still set bits i64 += 1 + Long.numberOfTrailingZeros(indexBits); final long bits = bitArray[o]; return (i64 << 6) | Long.numberOfTrailingZeros(bits); } + @Override + public int firstSetBitInRange(int start, int upperBound) { + assert start < length; + assert upperBound >= start; + final int i4096 = start >>> 12; + final long index = indices[i4096]; + final long[] bitArray = this.bits[i4096]; + int i64 = start >>> 6; + int o = Long.bitCount(index & ((1L << i64) - 1)); Review Comment: Makes sense! -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org