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.92 by dl, Sat Dec 2 20:55:01 2006 UTC vs.
Revision 1.93 by dl, Sun Dec 3 23:37:19 2006 UTC

# Line 150 | Line 150 | public class ConcurrentHashMap<K, V> ext
150       * defends against poor quality hash functions.  This is critical
151       * because ConcurrentHashMap uses power-of-two length hash tables,
152       * that otherwise encounter collisions for hashCodes that do not
153 <     * differ in lower bits.
153 >     * differ in lower or upper bits.
154       */
155      private static int hash(int h) {
156          // Spread bits to regularize both segment and index locations,
157 <        // using variant of Jenkins's shift-based hash.
158 <        h += ~(h << 13);
159 <        h ^= h >>> 7;
160 <        h += h << 3;
161 <        h ^= h >>> 17;
162 <        h += h << 5;
163 <        return h;
157 >        // using variant of single-word Wang/Jenkins hash.
158 >        h += (h <<  15) ^ 0xffffcd7d;
159 >        h ^= (h >>> 10);
160 >        h += (h <<   3);
161 >        h ^= (h >>>  6);
162 >        h += (h <<   2) + (h << 14);
163 >        return h ^ (h >>> 16);
164      }
165  
166      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines