diff options
author | Pap Lőrinc <paplorinc@gmail.com> | 2016-12-06 23:01:12 +0200 |
---|---|---|
committer | Pap Lőrinc <paplorinc@gmail.com> | 2016-12-07 13:38:02 +0200 |
commit | bc912230129d68466474bcc6c99356b44f65c3c2 (patch) | |
tree | 02de5dd74e3240fff4dd7ecbc97223110d8f8a54 /src/library/scala/collection/mutable/HashTable.scala | |
parent | 0339663cbbd4d22b0758257f2ce078b5a007f316 (diff) | |
download | scala-bc912230129d68466474bcc6c99356b44f65c3c2.tar.gz scala-bc912230129d68466474bcc6c99356b44f65c3c2.tar.bz2 scala-bc912230129d68466474bcc6c99356b44f65c3c2.zip |
Changed hashing bit rotation to use Integer.rotateRight
Diffstat (limited to 'src/library/scala/collection/mutable/HashTable.scala')
-rw-r--r-- | src/library/scala/collection/mutable/HashTable.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala index 776eafaccc..445217ebef 100644 --- a/src/library/scala/collection/mutable/HashTable.scala +++ b/src/library/scala/collection/mutable/HashTable.scala @@ -12,6 +12,9 @@ package scala package collection package mutable +import java.lang.Integer.rotateRight +import scala.util.hashing.byteswap32 + /** This class can be used to construct data structures that are based * on hashtables. Class `HashTable[A]` implements a hashtable * that maps keys of type `A` to values of the fully abstract @@ -424,11 +427,7 @@ private[collection] object HashTable { * }}} * the rest of the computation is due to SI-5293 */ - protected final def improve(hcode: Int, seed: Int): Int = { - val hash = scala.util.hashing.byteswap32(hcode) - val shift = seed & ((1 << 5) - 1) - (hash >>> shift) | (hash << (32 - shift)) - } + protected final def improve(hcode: Int, seed: Int): Int = rotateRight(byteswap32(hcode), seed) } /** |