Esempio n. 1
0
        private static bool PatchTestReg(FuncState fs, int node, int reg)
        {
            InstructionPtr pi = GetJumpControl(fs, node);

            if (pi.Value.GET_OPCODE() != OpCode.OP_TESTSET)
            {
                return(false);                // cannot patch other instructions
            }
            if (reg != NO_REG && reg != pi.Value.GETARG_B())
            {
                pi.Value = pi.Value.SETARG_A(reg);
            }
            else
            {
                pi.Value = Instruction.CreateABC(OpCode.OP_TEST,
                                                 pi.Value.GETARG_B(), 0, pi.Value.GETARG_C());
            }

            return(true);
        }
Esempio n. 2
0
 public static int CodeABC(FuncState fs, OpCode op, int a, int b, int c)
 {
     return(Code(fs, Instruction.CreateABC(op, a, b, c)));
 }