MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / constfolding

Function constfolding

third-party/lua-5.2.4/src/lcode.c:713–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711
712
713static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
714 lua_Number r;
715 if (!isnumeral(e1) || !isnumeral(e2)) return 0;
716 if ((op == OP_DIV || op == OP_MOD) && e2->u.nval == 0)
717 return 0; /* do not attempt to divide by 0 */
718 r = luaO_arith(op - OP_ADD + LUA_OPADD, e1->u.nval, e2->u.nval);
719 e1->u.nval = r;
720 return 1;
721}
722
723
724static void codearith (FuncState *fs, OpCode op,

Callers 1

codearithFunction · 0.70

Calls 2

isnumeralFunction · 0.70
luaO_arithFunction · 0.70

Tested by

no test coverage detected