diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-04 15:16:47 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-04 15:16:47 +0000 |
commit | 72b2715324a8d44cce5beac6e5911574eeb3fb5b (patch) | |
tree | 7303919da361021cd0e2312a7f3febb46ef02242 /src | |
parent | 1a45bc7f19a56bd7959a496f617b501d1eae7513 (diff) | |
download | scala-72b2715324a8d44cce5beac6e5911574eeb3fb5b.tar.gz scala-72b2715324a8d44cce5beac6e5911574eeb3fb5b.tar.bz2 scala-72b2715324a8d44cce5beac6e5911574eeb3fb5b.zip |
Fixes an inconsistency in primitive hashcode ca...
Fixes an inconsistency in primitive hashcode calculation. I did have a
test trying to spot exactly this situation, which says something about
either me or about testing or about me and testing. Closes #3957, no
review.
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 925e9b4b64..d6cace24c7 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -201,7 +201,9 @@ object ScalaRunTime { val lv = dv.toLong if (lv == dv) return lv.hashCode - else dv.hashCode + + val fv = dv.toFloat + if (fv == dv) fv.hashCode else dv.hashCode } @inline def hash(fv: Float): Int = { val iv = fv.toInt |