Java Code Examples for org.objectweb.asm.Opcodes#F2I

The following examples show how to use org.objectweb.asm.Opcodes#F2I . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StackHelper.java    From zelixkiller with GNU General Public License v3.0 4 votes vote down vote up
public InsnValue convertValue(AbstractInsnNode insn, InsnValue value) {
	Object obj = value.getValue();
	switch (insn.getOpcode()) {
	case Opcodes.I2L:
	case Opcodes.D2L:
	case Opcodes.F2L:
		if (obj == null) {
			return InsnValue.LONG_VALUE;
		}
		return InsnValue.longValue(((Number) obj).longValue());
	case Opcodes.I2F:
	case Opcodes.L2F:
	case Opcodes.D2F:
		if (obj == null) {
			return InsnValue.FLOAT_VALUE;
		}
		return InsnValue.floatValue(((Number) obj).floatValue());
	case Opcodes.L2I:
	case Opcodes.F2I:
	case Opcodes.D2I:
		if (obj == null) {
			return InsnValue.INT_VALUE;
		}
		return InsnValue.intValue(((Number) obj).intValue());
	case Opcodes.I2D:
	case Opcodes.L2D:
	case Opcodes.F2D:
		if (obj == null) {
			return InsnValue.DOUBLE_VALUE;
		}
		return InsnValue.doubleValue(((Number) obj).doubleValue());
	case Opcodes.I2B:
		if (obj == null) {
			return InsnValue.BYTE_VALUE;
		}
		return InsnValue.byteValue(((Number) obj).byteValue());
	case Opcodes.I2C:
		if (obj == null) {
			return InsnValue.CHAR_VALUE;
		}
		return InsnValue.charValue(((Number) obj).intValue());
	case Opcodes.I2S:
		if (obj == null) {
			return InsnValue.SHORT_VALUE;
		}
		return InsnValue.shortValue(((Number) obj).shortValue());
	}

	return null;
}
 
Example 2
Source File: ArithmeticExpression.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public static boolean isArithmeticOp(Instruction instr) {
    
    switch (instr.getOpcode()) {
        case Opcodes.ISHL:
        case Opcodes.ISHR:
        case Opcodes.LSHL:
        case Opcodes.LSHR:
        case Opcodes.IUSHR:
        case Opcodes.LUSHR:
        
        case Opcodes.DCMPG:
        case Opcodes.DCMPL:
        case Opcodes.FCMPG:
        case Opcodes.FCMPL:
        case Opcodes.LCMP:
        case Opcodes.FNEG:
        case Opcodes.DNEG:
        case Opcodes.INEG:
        case Opcodes.D2F:
        case Opcodes.D2I:
        case Opcodes.D2L:
        case Opcodes.F2D:
        case Opcodes.F2I:
        case Opcodes.F2L:
        case Opcodes.L2D:
        case Opcodes.L2F:
        case Opcodes.L2I:
        case Opcodes.I2L:
        case Opcodes.I2B:
        case Opcodes.I2C:
        case Opcodes.I2D:
        case Opcodes.I2F:
        case Opcodes.I2S:
        case Opcodes.IOR:
        case Opcodes.LOR:
        case Opcodes.IXOR:
        case Opcodes.LXOR:
        case Opcodes.IAND:
        case Opcodes.LAND:
        case Opcodes.FADD:
        case Opcodes.DADD:
        case Opcodes.IADD:
        case Opcodes.LADD:
        case Opcodes.FSUB:
        case Opcodes.DSUB:
        case Opcodes.ISUB:
        case Opcodes.LSUB:
        case Opcodes.FDIV:
        case Opcodes.DDIV:
        case Opcodes.LDIV:
        case Opcodes.IDIV:
        case Opcodes.IREM:
        case Opcodes.FREM:
        case Opcodes.DREM:
        case Opcodes.LREM:
        case Opcodes.FMUL:
        case Opcodes.DMUL:
        case Opcodes.IMUL:
        case Opcodes.LMUL:
            return true;
    }
    return false;
}