From 40d8832ee05096f9aea8eb54d1cdccf2646aecd0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 11 Sep 2019 10:20:10 -0300 Subject: Simplification in the call to 'constfolding' --- lcode.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lcode.h') diff --git a/lcode.h b/lcode.h index 8cecd538..49c913ab 100644 --- a/lcode.h +++ b/lcode.h @@ -24,19 +24,27 @@ ** grep "ORDER OPR" if you change these enums (ORDER OP) */ typedef enum BinOpr { + /* arithmetic operators */ OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, - OPR_DIV, - OPR_IDIV, + OPR_DIV, OPR_IDIV, + /* bitwise operators */ OPR_BAND, OPR_BOR, OPR_BXOR, OPR_SHL, OPR_SHR, + /* string operator */ OPR_CONCAT, + /* comparison operators */ OPR_EQ, OPR_LT, OPR_LE, OPR_NE, OPR_GT, OPR_GE, + /* logical operators */ OPR_AND, OPR_OR, OPR_NOBINOPR } BinOpr; +/* true if operation is foldable (that is, it is arithmetic or bitwise) */ +#define foldbinop(op) ((op) <= OPR_SHR) + + #define luaK_codeABC(fs,o,a,b,c) luaK_codeABCk(fs,o,a,b,c,0) -- cgit v1.2.3-55-g6feb