MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / validop

Function validop

src/Chain/libraries/glua/lcode.cpp:750–761  ·  view source on GitHub ↗

** return false if folding can raise an error */

Source from the content-addressed store, hash-verified

748** return false if folding can raise an error
749*/
750static int validop(int op, TValue *v1, TValue *v2) {
751 switch (op) {
752 case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR:
753 case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */
754 lua_Integer i;
755 return (tointeger(v1, &i) && tointeger(v2, &i));
756 }
757 case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */
758 return (nvalue(v2) != 0);
759 default: return 1; /* everything else is valid */
760 }
761}
762
763
764/*

Callers 1

constfoldingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected