gsmiller commented on code in PR #13559: URL: https://github.com/apache/lucene/pull/13559#discussion_r1697623524
########## lucene/core/src/java/org/apache/lucene/util/FixedBitSet.java: ########## @@ -291,6 +291,32 @@ public int nextSetBit(int index) { return DocIdSetIterator.NO_MORE_DOCS; } + @Override + public int firstSetBitInRange(int start, int upperBound) { + // Depends on the ghost bits being clear! + assert start >= 0 && start < numBits : "index=" + start + ", numBits=" + numBits; + assert start <= upperBound : "index=" + start + ", upperBound=" + upperBound; + int i = start >> 6; + long word = bits[i] >> start; // skip all the bits to the right of index + + if (word != 0) { + int res = start + Long.numberOfTrailingZeros(word); + return res > upperBound ? DocIdSetIterator.NO_MORE_DOCS : res; + } + + int maxWord = Math.min((upperBound >> 6) + 1, numWords); Review Comment: Ah, that's even better. Thanks! -- 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