ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.309 by jsr166, Fri Apr 27 16:28:09 2018 UTC vs.
Revision 1.310 by jsr166, Wed May 23 06:11:41 2018 UTC

# Line 673 | Line 673 | public class ConcurrentHashMap<K,V> exte
673       * See Hackers Delight, sec 3.2
674       */
675      private static final int tableSizeFor(int c) {
676 <        int n = c - 1;
677 <        n |= n >>> 1;
678 <        n |= n >>> 2;
679 <        n |= n >>> 4;
680 <        n |= n >>> 8;
681 <        n |= n >>> 16;
676 >        int n = -1 >>> Integer.numberOfLeadingZeros(c - 1);
677          return (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;
678      }
679  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines