Go to the documentation of this file.
39 #define SIZE_Bx (SIZE_C + SIZE_B)
45 #define POS_B (POS_C + SIZE_C)
47 #define POS_A (POS_B + SIZE_B)
55 #if SIZE_Bx < BITS_INT-1
56 #define MAXARG_Bx ((1<<SIZE_Bx)-1)
57 #define MAXARG_sBx (MAXARG_Bx>>1)
59 #define MAXARG_Bx MAX_INT
60 #define MAXARG_sBx MAX_INT
64 #define MAXARG_A ((1<<SIZE_A)-1)
65 #define MAXARG_B ((1<<SIZE_B)-1)
66 #define MAXARG_C ((1<<SIZE_C)-1)
70 #define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
73 #define MASK0(n,p) (~MASK1(n,p))
79 #define GET_OPCODE(i) (cast(OpCode, (i)&MASK1(SIZE_OP,0)))
80 #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,0)) | cast(Instruction, o)))
82 #define GETARG_A(i) (cast(int, (i)>>POS_A))
83 #define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
84 ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))
86 #define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
87 #define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
88 ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))
90 #define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
91 #define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
92 ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))
94 #define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
95 #define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
96 ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))
98 #define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
99 #define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
102 #define CREATE_ABC(o,a,b,c) (cast(Instruction, o) \
103 | (cast(Instruction, a)<<POS_A) \
104 | (cast(Instruction, b)<<POS_B) \
105 | (cast(Instruction, c)<<POS_C))
107 #define CREATE_ABx(o,a,bc) (cast(Instruction, o) \
108 | (cast(Instruction, a)<<POS_A) \
109 | (cast(Instruction, bc)<<POS_Bx))
117 #define NO_REG MAXARG_A
189 #define NUM_OPCODES (cast(int, OP_CLOSURE+1))
224 #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
225 #define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b)))
229 extern const char *
const luaP_opnames[];
236 #define LFIELDS_PER_FLUSH 32