diff options
author | Paul Phillips <paulp@improving.org> | 2011-09-08 05:43:32 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-09-08 05:43:32 +0000 |
commit | 52c1d019d63d2fffadc8f3f159d654187ac61ece (patch) | |
tree | 6958700cb96b574b0894b3792f76be68d2a7161d /src/compiler | |
parent | c37e8f45cf86d0a3f6cb084e85f9751f5e906bf2 (diff) | |
download | scala-52c1d019d63d2fffadc8f3f159d654187ac61ece.tar.gz scala-52c1d019d63d2fffadc8f3f159d654187ac61ece.tar.bz2 scala-52c1d019d63d2fffadc8f3f159d654187ac61ece.zip |
Refinement of murmurhash implementation.
Integrates recent speed improvements to algorithm.
Contributed by Ruediger Keller, no review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/BitSet.scala | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/util/BitSet.scala b/src/compiler/scala/tools/nsc/util/BitSet.scala index a8d54c2c84..de0c6fd62a 100644 --- a/src/compiler/scala/tools/nsc/util/BitSet.scala +++ b/src/compiler/scala/tools/nsc/util/BitSet.scala @@ -72,20 +72,15 @@ abstract class BitSet { } override def hashCode: Int = { - import scala.util.MurmurHash._ - var h = startHash(hashSeed) - var c = startMagicA - var k = startMagicB - for (idx <- 0 until nwords) { - val w = word(idx) - h = extendHash(h, (w>>>32).toInt, c, k) - c = nextMagicA(c) - k = nextMagicB(k) - h = extendHash(h, w.toInt, c, k) - c = nextMagicA(c) - k = nextMagicB(k) + import scala.util.MurmurHash3._ + var h = hashSeed + var i = 0; while(i < nwords) { + val w = word(i) + h = mix(h, (w >>> 32).toInt) + h = mix(h, w.toInt) + i += 1 } - finalizeHash(h) + finalizeHash(h, nwords) } def addString(sb: StringBuilder, start: String, sep: String, end: String) { |