Janitorial work in 'lcode.c'
This commit is contained in:
13
lopcodes.h
13
lopcodes.h
@@ -97,6 +97,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
|
||||
#define MAXARG_C ((1<<SIZE_C)-1)
|
||||
#define OFFSET_sC (MAXARG_C >> 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) */
|
||||
|
||||
Reference in New Issue
Block a user