aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-09-19 14:29:21 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-09-19 14:29:21 -0300
commit6b2e202df55f3d1f3c670eab65981db6e125c758 (patch)
tree47defe0dfa8b2448bac44ebb2174cd310bd90eee /lopcodes.h
parent40d8832ee05096f9aea8eb54d1cdccf2646aecd0 (diff)
downloadlua-6b2e202df55f3d1f3c670eab65981db6e125c758.tar.gz
lua-6b2e202df55f3d1f3c670eab65981db6e125c758.tar.bz2
lua-6b2e202df55f3d1f3c670eab65981db6e125c758.zip
Janitorial work in 'lcode.c'
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h13
1 files changed, 8 insertions, 5 deletions
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 */
97#define MAXARG_C ((1<<SIZE_C)-1) 97#define MAXARG_C ((1<<SIZE_C)-1)
98#define OFFSET_sC (MAXARG_C >> 1) 98#define OFFSET_sC (MAXARG_C >> 1)
99 99
100#define int2sC(i) ((i) + OFFSET_sC)
101#define sC2int(i) ((i) - OFFSET_sC)
102
100 103
101/* creates a mask with 'n' 1 bits at position 'p' */ 104/* creates a mask with 'n' 1 bits at position 'p' */
102#define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p)) 105#define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p))
@@ -123,11 +126,11 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
123#define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A) 126#define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A)
124 127
125#define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B)) 128#define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B))
126#define GETARG_sB(i) (GETARG_B(i) - OFFSET_sC) 129#define GETARG_sB(i) sC2int(GETARG_B(i))
127#define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B) 130#define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B)
128 131
129#define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C)) 132#define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C))
130#define GETARG_sC(i) (GETARG_C(i) - OFFSET_sC) 133#define GETARG_sC(i) sC2int(GETARG_C(i))
131#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) 134#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
132 135
133#define TESTARG_k(i) (cast_int(((i) & (1u << POS_k)))) 136#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) */
249OP_SHL,/* A B C R(A) := R(B) << R(C) */ 252OP_SHL,/* A B C R(A) := R(B) << R(C) */
250OP_SHR,/* A B C R(A) := R(B) >> R(C) */ 253OP_SHR,/* A B C R(A) := R(B) >> R(C) */
251 254
252OP_MMBIN,/* A B C call B metamethod for previous bin. operation */ 255OP_MMBIN,/* A B C call C metamethod over R(A) and R(B) */
253OP_MMBINI,/* A B C call B metamethod for previous binI. operation */ 256OP_MMBINI,/* A B C call C metamethod over R(A) and B */
254OP_MMBINK,/* A B C call B metamethod for previous binK. operation */ 257OP_MMBINK,/* A B C call C metamethod over R(A) and K(B) */
255 258
256OP_UNM,/* A B R(A) := -R(B) */ 259OP_UNM,/* A B R(A) := -R(B) */
257OP_BNOT,/* A B R(A) := ~R(B) */ 260OP_BNOT,/* A B R(A) := ~R(B) */