MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / intarith

Function intarith

lib/lua/src/lobject.c:53–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52
53static lua_Integer intarith (lua_State *L, int op, lua_Integer v1,
54 lua_Integer v2) {
55 switch (op) {
56 case LUA_OPADD: return intop(+, v1, v2);
57 case LUA_OPSUB:return intop(-, v1, v2);
58 case LUA_OPMUL:return intop(*, v1, v2);
59 case LUA_OPMOD: return luaV_mod(L, v1, v2);
60 case LUA_OPIDIV: return luaV_idiv(L, v1, v2);
61 case LUA_OPBAND: return intop(&, v1, v2);
62 case LUA_OPBOR: return intop(|, v1, v2);
63 case LUA_OPBXOR: return intop(^, v1, v2);
64 case LUA_OPSHL: return luaV_shiftl(v1, v2);
65 case LUA_OPSHR: return luaV_shiftr(v1, v2);
66 case LUA_OPUNM: return intop(-, 0, v1);
67 case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1);
68 default: lua_assert(0); return 0;
69 }
70}
71
72
73static lua_Number numarith (lua_State *L, int op, lua_Number v1,

Callers 1

luaO_rawarithFunction · 0.85

Calls 3

luaV_modFunction · 0.85
luaV_idivFunction · 0.85
luaV_shiftlFunction · 0.85

Tested by

no test coverage detected