From fc07ece2e71a722dc44d366c8463dd27f825e289 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 11 Nov 2009 00:56:31 +0000 Subject: 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. --- src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/msil') diff --git a/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala b/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala index 076bf50360..e7bff447cc 100644 --- a/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala +++ b/src/msil/ch/epfl/lamp/compiler/msil/emit/OpCode.scala @@ -52,13 +52,13 @@ class OpCode extends Visitable { protected def length(): byte = { val code = OpCode.length(CEE_code) val inline = OpCode.INLINE_length(CEE_inline) - return if(inline < 0) { -1 } else { (code + inline).asInstanceOf[byte] } + return if(inline < 0) { -1 } else { (code + inline).toByte } } protected def popush(): byte = { val pop = OpCode.POP_size(CEE_pop) val push = OpCode.PUSH_size(CEE_push) - return if(pop < 0 || push < 0) { OpCode.POPUSH_SPECIAL } else { (push - pop).asInstanceOf[byte] } + return if(pop < 0 || push < 0) { OpCode.POPUSH_SPECIAL } else { (push - pop).toByte } } override def toString(): String = { @@ -524,7 +524,7 @@ object OpCode { pop: byte, push: byte, inline: byte, flow: byte) { that.CEE_opcode = opcode that.CEE_string = string - that.CEE_code = code.asInstanceOf[short] + that.CEE_code = code.toShort that.CEE_pop = pop that.CEE_push = push that.CEE_inline = inline -- cgit v1.2.3