diff options
author | Paul Phillips <paulp@improving.org> | 2009-11-11 00:56:31 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-11-11 00:56:31 +0000 |
commit | fc07ece2e71a722dc44d366c8463dd27f825e289 (patch) | |
tree | 3ebd81e90b98cbd394d60e58947a405f2bd41204 /src/scalap | |
parent | 1e9a86e70122babbba0d248b930b78584871fc87 (diff) | |
download | scala-fc07ece2e71a722dc44d366c8463dd27f825e289.tar.gz scala-fc07ece2e71a722dc44d366c8463dd27f825e289.tar.bz2 scala-fc07ece2e71a722dc44d366c8463dd27f825e289.zip |
The preferred way to convert between primitives...
The preferred way to convert between primitives is to call .toInt etc,
but there were lots of casts for historical reasons. This patch remedies
that.
Diffstat (limited to 'src/scalap')
-rw-r--r-- | src/scalap/scala/tools/scalap/ByteArrayReader.scala | 4 | ||||
-rw-r--r-- | src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/scalap/scala/tools/scalap/ByteArrayReader.scala b/src/scalap/scala/tools/scalap/ByteArrayReader.scala index 9f9fceab26..2fde050782 100644 --- a/src/scalap/scala/tools/scalap/ByteArrayReader.scala +++ b/src/scalap/scala/tools/scalap/ByteArrayReader.scala @@ -61,7 +61,7 @@ class ByteArrayReader(content: Array[Byte]) { /** read a long */ def nextLong: Long = - (nextInt.asInstanceOf[Long] << 32) + (nextInt.asInstanceOf[Long] & 0xffffffffL) + (nextInt.toLong << 32) + (nextInt.toLong & 0xffffffffL) /** read a float */ @@ -138,7 +138,7 @@ class ByteArrayReader(content: Array[Byte]) { /** extract a long integer at position bp from buf */ def getLong(bp: Int): Long = - (getInt(bp).asInstanceOf[Long] << 32) + (getInt(bp + 4).asInstanceOf[Long] & 0xffffffffL) + (getInt(bp).toLong << 32) + (getInt(bp + 4).toLong & 0xffffffffL) /** extract a float at position bp from buf */ diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala index 5ae6ef7c64..c78ed83a33 100644 --- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala +++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala @@ -247,12 +247,12 @@ object ScalaSigEntryParsers extends RulesWithState with MemoisableRules { lazy val literal = oneOf( 24 -^ (), 25 -~ longValue ^^ (_ != 0L), - 26 -~ longValue ^^ (_.asInstanceOf[Byte]), - 27 -~ longValue ^^ (_.asInstanceOf[Short]), - 28 -~ longValue ^^ (_.asInstanceOf[Char]), - 29 -~ longValue ^^ (_.asInstanceOf[Int]), - 30 -~ longValue ^^ (_.asInstanceOf[Long]), - 31 -~ longValue ^^ (l => java.lang.Float.intBitsToFloat(l.asInstanceOf[Int])), + 26 -~ longValue ^^ (_.toByte), + 27 -~ longValue ^^ (_.toShort), + 28 -~ longValue ^^ (_.toChar), + 29 -~ longValue ^^ (_.toInt), + 30 -~ longValue ^^ (_.toLong), + 31 -~ longValue ^^ (l => java.lang.Float.intBitsToFloat(l.toInt)), 32 -~ longValue ^^ (java.lang.Double.longBitsToDouble), 33 -~ nameRef, 34 -^ null, |