| 51 | |
| 52 | |
| 53 | static 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 | |
| 73 | static lua_Number numarith (lua_State *L, int op, lua_Number v1, |
no test coverage detected