MCPcopy Create free account
hub / github.com/DFHack/dfhack / intarith

Function intarith

depends/lua/src/lobject.c:83–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83static lua_Integer intarith (lua_State *L, int op, lua_Integer v1,
84 lua_Integer v2) {
85 switch (op) {
86 case LUA_OPADD: return intop(+, v1, v2);
87 case LUA_OPSUB:return intop(-, v1, v2);
88 case LUA_OPMUL:return intop(*, v1, v2);
89 case LUA_OPMOD: return luaV_mod(L, v1, v2);
90 case LUA_OPIDIV: return luaV_div(L, v1, v2);
91 case LUA_OPBAND: return intop(&, v1, v2);
92 case LUA_OPBOR: return intop(|, v1, v2);
93 case LUA_OPBXOR: return intop(^, v1, v2);
94 case LUA_OPSHL: return luaV_shiftl(v1, v2);
95 case LUA_OPSHR: return luaV_shiftl(v1, -v2);
96 case LUA_OPUNM: return intop(-, 0, v1);
97 case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1);
98 default: lua_assert(0); return 0;
99 }
100}
101
102
103static lua_Number numarith (lua_State *L, int op, lua_Number v1,

Callers 1

luaO_arithFunction · 0.85

Calls 3

luaV_modFunction · 0.85
luaV_divFunction · 0.85
luaV_shiftlFunction · 0.85

Tested by

no test coverage detected