# 1 "./lua/lopcodes.h" #ifndef lopcodes_h #define lopcodes_h #include "llimits.h" # 32 "./lua/lopcodes.h" enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; #define SIZE_C 8 #define SIZE_B 8 #define SIZE_Bx (SIZE_C + SIZE_B + 1) #define SIZE_A 8 #define SIZE_Ax (SIZE_Bx + SIZE_A) #define SIZE_sJ (SIZE_Bx + SIZE_A) #define SIZE_OP 7 #define POS_OP 0 #define POS_A (POS_OP + SIZE_OP) #define POS_k (POS_A + SIZE_A) #define POS_B (POS_k + 1) #define POS_C (POS_B + SIZE_B) #define POS_Bx POS_k #define POS_Ax POS_A #define POS_sJ POS_A # 68 "./lua/lopcodes.h" #define L_INTHASBITS(b) ((UINT_MAX >> ((b) - 1)) >= 1) #if L_INTHASBITS(SIZE_Bx) #define MAXARG_Bx ((1<>1) #if L_INTHASBITS(SIZE_Ax) #define MAXARG_Ax ((1<> 1) #define MAXARG_A ((1<> 1) #define int2sC(i) ((i) + OFFSET_sC) #define sC2int(i) ((i) - OFFSET_sC) #define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p)) #define MASK0(n,p) (~MASK1(n,p)) #define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ ((cast(Instruction, o)<>(pos)) & MASK1(size,0))) #define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ ((cast(Instruction, v)<