1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 import com.sun.org.apache.bcel.internal.Constants; 57 63 public abstract class ConversionInstruction extends Instruction 64 implements TypedInstruction, StackProducer, StackConsumer { 65 69 ConversionInstruction() {} 70 71 74 protected ConversionInstruction(short opcode) { 75 super(opcode, (short)1); 76 } 77 78 80 public Type getType(ConstantPoolGen cp) { 81 switch(opcode) { 82 case Constants.D2I: case Constants.F2I: case Constants.L2I: 83 return Type.INT; 84 case Constants.D2F: case Constants.I2F: case Constants.L2F: 85 return Type.FLOAT; 86 case Constants.D2L: case Constants.F2L: case Constants.I2L: 87 return Type.LONG; 88 case Constants.F2D: case Constants.I2D: case Constants.L2D: 89 return Type.DOUBLE; 90 case Constants.I2B: 91 return Type.BYTE; 92 case Constants.I2C: 93 return Type.CHAR; 94 case Constants.I2S: 95 return Type.SHORT; 96 97 default: throw new ClassGenException("Unknown type " + opcode); 99 } 100 } 101 } 102 103 | Popular Tags |