| 113 | |
| 114 | |
| 115 | static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, |
| 116 | lua_Integer v2) { |
| 117 | switch (op) { |
| 118 | case LUA_OPADD: return intop(+, v1, v2); |
| 119 | case LUA_OPSUB:return intop(-, v1, v2); |
| 120 | case LUA_OPMUL:return intop(*, v1, v2); |
| 121 | case LUA_OPMOD: return luaV_mod(L, v1, v2); |
| 122 | case LUA_OPIDIV: return luaV_idiv(L, v1, v2); |
| 123 | case LUA_OPBAND: return intop(&, v1, v2); |
| 124 | case LUA_OPBOR: return intop(|, v1, v2); |
| 125 | case LUA_OPBXOR: return intop(^, v1, v2); |
| 126 | case LUA_OPSHL: return luaV_shiftl(v1, v2); |
| 127 | case LUA_OPSHR: return luaV_shiftr(v1, v2); |
| 128 | case LUA_OPUNM: return intop(-, 0, v1); |
| 129 | case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); |
| 130 | default: lua_assert(0); return 0; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | |
| 135 | static lua_Number numarith (lua_State *L, int op, lua_Number v1, |
no test coverage detected