From 4518e5df24600cacdb3bab75d640348d28e8b769 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 6 Sep 2019 14:14:11 -0300 Subject: Added macro 'testMMMode' Macro 'testMMMode' checks whether opcode is an MM opcode. --- lopcodes.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index fd578c68..c5e9cf81 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -359,6 +359,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ ** bit 4: operator is a test (next instruction must be a jump) ** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0) ** bit 6: instruction sets 'L->top' for next instruction (when C == 0) +** bit 7: instruction is an MM instruction (call a metamethod) */ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) @@ -368,6 +369,7 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) #define testTMode(m) (luaP_opmodes[m] & (1 << 4)) #define testITMode(m) (luaP_opmodes[m] & (1 << 5)) #define testOTMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testMMMode(m) (luaP_opmodes[m] & (1 << 7)) /* "out top" (set top for next instruction) */ #define isOT(i) \ @@ -377,7 +379,8 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) /* "in top" (uses top from previous instruction) */ #define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0) -#define opmode(ot,it,t,a,m) (((ot)<<6) | ((it)<<5) | ((t)<<4) | ((a)<<3) | (m)) +#define opmode(mm,ot,it,t,a,m) \ + (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m)) /* number of list items to accumulate before a SETLIST instruction */ -- cgit v1.2.3-55-g6feb