diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-09-19 14:29:21 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-09-19 14:29:21 -0300 |
commit | 6b2e202df55f3d1f3c670eab65981db6e125c758 (patch) | |
tree | 47defe0dfa8b2448bac44ebb2174cd310bd90eee /lopcodes.h | |
parent | 40d8832ee05096f9aea8eb54d1cdccf2646aecd0 (diff) | |
download | lua-6b2e202df55f3d1f3c670eab65981db6e125c758.tar.gz lua-6b2e202df55f3d1f3c670eab65981db6e125c758.tar.bz2 lua-6b2e202df55f3d1f3c670eab65981db6e125c758.zip |
Janitorial work in 'lcode.c'
Diffstat (limited to 'lopcodes.h')
-rw-r--r-- | lopcodes.h | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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) */ | |||
249 | OP_SHL,/* A B C R(A) := R(B) << R(C) */ | 252 | OP_SHL,/* A B C R(A) := R(B) << R(C) */ |
250 | OP_SHR,/* A B C R(A) := R(B) >> R(C) */ | 253 | OP_SHR,/* A B C R(A) := R(B) >> R(C) */ |
251 | 254 | ||
252 | OP_MMBIN,/* A B C call B metamethod for previous bin. operation */ | 255 | OP_MMBIN,/* A B C call C metamethod over R(A) and R(B) */ |
253 | OP_MMBINI,/* A B C call B metamethod for previous binI. operation */ | 256 | OP_MMBINI,/* A B C call C metamethod over R(A) and B */ |
254 | OP_MMBINK,/* A B C call B metamethod for previous binK. operation */ | 257 | OP_MMBINK,/* A B C call C metamethod over R(A) and K(B) */ |
255 | 258 | ||
256 | OP_UNM,/* A B R(A) := -R(B) */ | 259 | OP_UNM,/* A B R(A) := -R(B) */ |
257 | OP_BNOT,/* A B R(A) := ~R(B) */ | 260 | OP_BNOT,/* A B R(A) := ~R(B) */ |