@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
public static BuilderInstruction buildConstant(float value, int register) { if (value % 1 == 0) { // No decimal portion if (value <= Integer.MAX_VALUE) { return buildConstant(((Float) value).intValue(), register); } } int intBits = Float.floatToIntBits(value); String binaryValue = Integer.toBinaryString(intBits); BuilderInstruction constant; if (binaryValue.endsWith(LAST_16_BITS_ZERO)) { constant = new BuilderInstruction21ih(Opcode.CONST_HIGH16, register, intBits); } else { constant = new BuilderInstruction31i(Opcode.CONST, register, intBits); } return constant; }
@Test public void withValueWithLast16BitsZero() { int intBits = 0xFF0000; float value = Float.intBitsToFloat(intBits); Instruction expected = new BuilderInstruction21ih(Opcode.CONST_HIGH16, REGISTER, intBits); Instruction actual = ConstantBuilder.buildConstant(value, REGISTER); testEquals(expected, actual); } }
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction21ih(opcode, regA, litB));
@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) { return new BuilderInstruction21ih( instruction.getOpcode(), instruction.getRegisterA(), instruction.getNarrowLiteral()); }
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction21ih(opcode, regA, litB));
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction21ih(opcode, regA, litB));