MCPcopy Create free account
hub / github.com/F-Stack/f-stack / constfolding

Function constfolding

freebsd/contrib/openzfs/module/lua/lcode.c:711–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

codearithFunction · 0.70

Calls 2

luaO_arithFunction · 0.85
isnumeralFunction · 0.70

Tested by

no test coverage detected