mikemccand commented on code in PR #15585:
URL: https://github.com/apache/lucene/pull/15585#discussion_r2732138703


##########
lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java:
##########
@@ -74,12 +75,28 @@ public static MemorySegmentIndexInput newInstance(
       boolean confined,
       Function<IOContext, ReadAdvice> toReadAdvice) {
     assert 
Arrays.stream(segments).map(MemorySegment::scope).allMatch(arena.scope()::equals);
+    AtomicInteger sharedPrefetchCounter = new AtomicInteger();

Review Comment:
   Thank you for the quick test case!
   
   Wow, so `isZeroOrPowerOfTwo(-1) = true`?  OK I see its javadocs:
   
   ```
     /**                                                                        
                                                                                
                                                                                
                                                                                
                                                                   
      * Return true if, and only if, the provided integer - treated as an 
unsigned integer - is either                                                    
                                                                                
                                                                                
                                                                         
      * 0 or a power of two.                                                    
                                                                                
                                                                                
                                                                                
                                                                   
      */
   ```
   
   -1 in binary 2s complement is `10000000000000000000000000000000` (1 followed 
by 31 zeros), which if you interpret as unsigned int is `2147483648` which is a 
power-of-two.  Tricky!



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