From 72b2715324a8d44cce5beac6e5911574eeb3fb5b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 4 Dec 2010 15:16:47 +0000 Subject: 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. --- src/library/scala/runtime/ScalaRunTime.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3