diff options
author | Paul Phillips <paulp@improving.org> | 2010-03-19 21:48:42 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-03-19 21:48:42 +0000 |
commit | 6613b1cdae66ae23edfd0e20eb5d4d066018681d (patch) | |
tree | c033a214a3d7e15ca01cdf778b88ac6e026c0fb7 /src/library/scala/Predef.scala | |
parent | f2be3e6836014b3e4db9c7eca3bb4da8ab447f89 (diff) | |
download | scala-6613b1cdae66ae23edfd0e20eb5d4d066018681d.tar.gz scala-6613b1cdae66ae23edfd0e20eb5d4d066018681d.tar.bz2 scala-6613b1cdae66ae23edfd0e20eb5d4d066018681d.zip |
Returning to the thrilling world of equality an...
Returning to the thrilling world of equality and hashCodes now
that Any.## is a reality. Moved the hash functions from Predef to
ScalaRunTime, and made what appears to be an optimization to equals by
not losing the result of an instanceof test. Review by community.
Diffstat (limited to 'src/library/scala/Predef.scala')
-rw-r--r-- | src/library/scala/Predef.scala | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 760d215d3f..d022b3e4a5 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -53,22 +53,6 @@ object Predef extends LowPriorityImplicits { @inline def locally[T](x: T): T = x - // hashcode ----------------------------------------------------------- - - @inline def hash(x: Any): Int = - if (x.isInstanceOf[Number]) runtime.BoxesRunTime.hashFromNumber(x.asInstanceOf[Number]) - else x.hashCode - - @inline def hash(x: Number): Int = - runtime.BoxesRunTime.hashFromNumber(x) - - @inline def hash(x: java.lang.Long): Int = { - val iv = x.intValue - if (iv == x.longValue) iv else x.hashCode - } - - @inline def hash(x: Int): Int = x - // errors and asserts ------------------------------------------------- def error(message: String): Nothing = throw new RuntimeException(message) |