From 6b2e202df55f3d1f3c670eab65981db6e125c758 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 19 Sep 2019 14:29:21 -0300 Subject: Janitorial work in 'lcode.c' --- lopcodes.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index d07a6e2d..95241702 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -97,6 +97,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ #define MAXARG_C ((1<> 1) +#define int2sC(i) ((i) + OFFSET_sC) +#define sC2int(i) ((i) - OFFSET_sC) + /* creates a mask with 'n' 1 bits at position 'p' */ #define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p)) @@ -123,11 +126,11 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ #define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A) #define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B)) -#define GETARG_sB(i) (GETARG_B(i) - OFFSET_sC) +#define GETARG_sB(i) sC2int(GETARG_B(i)) #define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B) #define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C)) -#define GETARG_sC(i) (GETARG_C(i) - OFFSET_sC) +#define GETARG_sC(i) sC2int(GETARG_C(i)) #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) #define TESTARG_k(i) (cast_int(((i) & (1u << POS_k)))) @@ -249,9 +252,9 @@ OP_BXOR,/* A B C R(A) := R(B) ~ R(C) */ OP_SHL,/* A B C R(A) := R(B) << R(C) */ OP_SHR,/* A B C R(A) := R(B) >> R(C) */ -OP_MMBIN,/* A B C call B metamethod for previous bin. operation */ -OP_MMBINI,/* A B C call B metamethod for previous binI. operation */ -OP_MMBINK,/* A B C call B metamethod for previous binK. operation */ +OP_MMBIN,/* A B C call C metamethod over R(A) and R(B) */ +OP_MMBINI,/* A B C call C metamethod over R(A) and B */ +OP_MMBINK,/* A B C call C metamethod over R(A) and K(B) */ OP_UNM,/* A B R(A) := -R(B) */ OP_BNOT,/* A B R(A) := ~R(B) */ -- cgit v1.2.3-55-g6feb