@@ -411,58 +411,10 @@ private[collection] object HashTable {
411
411
412
412
protected def elemHashCode (key : KeyType ) = key.##
413
413
414
- protected final def improve (hcode : Int , seed : Int ) = {
415
- /* Murmur hash
416
- * m = 0x5bd1e995
417
- * r = 24
418
- * note: h = seed = 0 in mmix
419
- * mmix(h,k) = k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; */
420
- // var k = hcode * 0x5bd1e995
421
- // k ^= k >> 24
422
- // k *= 0x5bd1e995
423
- // k
424
-
425
- /* Another fast multiplicative hash
426
- * by Phil Bagwell
427
- *
428
- * Comment:
429
- * Multiplication doesn't affect all the bits in the same way, so we want to
430
- * multiply twice, "once from each side".
431
- * It would be ideal to reverse all the bits after the first multiplication,
432
- * however, this is more costly. We therefore restrict ourselves only to
433
- * reversing the bytes before final multiplication. This yields a slightly
434
- * worse entropy in the lower 8 bits, but that can be improved by adding:
435
- *
436
- * `i ^= i >> 6`
437
- *
438
- * For performance reasons, we avoid this improvement.
439
- * */
440
- val i = scala.util.hashing.byteswap32(hcode)
441
-
442
- /* Jenkins hash
443
- * for range 0-10000, output has the msb set to zero */
444
- // var h = hcode + (hcode << 12)
445
- // h ^= (h >> 22)
446
- // h += (h << 4)
447
- // h ^= (h >> 9)
448
- // h += (h << 10)
449
- // h ^= (h >> 2)
450
- // h += (h << 7)
451
- // h ^= (h >> 12)
452
- // h
453
-
454
- /* OLD VERSION
455
- * quick, but bad for sequence 0-10000 - little entropy in higher bits
456
- * since 2003 */
457
- // var h: Int = hcode + ~(hcode << 9)
458
- // h = h ^ (h >>> 14)
459
- // h = h + (h << 4)
460
- // h ^ (h >>> 10)
461
-
462
- // the rest of the computation is due to SI-5293
463
- val rotation = seed % 32
464
- val rotated = (i >>> rotation) | (i << (32 - rotation))
465
- rotated
414
+ protected final def improve (hcode : Int , seed : Int ): Int = {
415
+ val i = scala.util.hashing.byteswap32(hcode)
416
+ val rotation = seed & ((1 << 5 ) - 1 )
417
+ (i >>> rotation) | (i << (32 - rotation))
466
418
}
467
419
}
468
420
0 commit comments