From 722bdbe17d0192baf72978f88069d12a921e9bfb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 28 Sep 2017 13:53:29 -0300 Subject: no more 'getBMode'-'getCMode' (imprecise + we will need more space for op mode) + better control of op modes --- lopcodes.h | 57 +++++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index d28948d8..6b9c3aeb 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.160 2017/09/19 18:38:14 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.161 2017/09/26 18:14:45 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -89,6 +89,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ #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)<> 4) & 3)) -#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) -#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) -#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 7)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 3)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 4)) + +#define opmode(t,a,m) (((t)<<4) | ((a)<<3) | (m)) LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ -- cgit v1.2.3-55-g6feb