| 15144 | |
| 15145 | |
| 15146 | static void Arith (lua_State *L, StkId ra, const TValue *rb, |
| 15147 | const TValue *rc, TMS op) { |
| 15148 | TValue tempb, tempc; |
| 15149 | const TValue *b, *c; |
| 15150 | if ((b = luaV_tonumber(rb, &tempb)) != NULL && |
| 15151 | (c = luaV_tonumber(rc, &tempc)) != NULL) { |
| 15152 | lua_Number nb = nvalue(b), nc = nvalue(c); |
| 15153 | switch (op) { |
| 15154 | case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; |
| 15155 | case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; |
| 15156 | case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; |
| 15157 | case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; |
| 15158 | case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; |
| 15159 | case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; |
| 15160 | case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; |
| 15161 | default: lua_assert(0); break; |
| 15162 | } |
| 15163 | } |
| 15164 | else if (!call_binTM(L, rb, rc, ra, op)) |
| 15165 | luaG_aritherror(L, rb, rc); |
| 15166 | } |
| 15167 | |
| 15168 | |
| 15169 |
no test coverage detected