| 408 | */ |
| 409 | |
| 410 | void luaV_arith (lua_State *L, StkId ra, const TValue *rb, |
| 411 | const TValue *rc, TMS op) { |
| 412 | TValue tempb, tempc; |
| 413 | const TValue *b, *c; |
| 414 | if ((b = luaV_tonumber(rb, &tempb)) != NULL && |
| 415 | (c = luaV_tonumber(rc, &tempc)) != NULL) { |
| 416 | /* |
| 417 | * Patched: if dividing or modding, use patched functions from 5.3 |
| 418 | */ |
| 419 | lua_Number res; |
| 420 | int lop = op - TM_ADD + LUA_OPADD; |
| 421 | if (lop == LUA_OPDIV) { |
| 422 | res = luaV_div(L, nvalue(b), nvalue(c)); |
| 423 | } else if (lop == LUA_OPMOD) { |
| 424 | res = luaV_mod(L, nvalue(b), nvalue(c)); |
| 425 | } else { |
| 426 | res = luaO_arith(op - TM_ADD + LUA_OPADD, nvalue(b), nvalue(c)); |
| 427 | } |
| 428 | setnvalue(ra, res); |
| 429 | } |
| 430 | else if (!call_binTM(L, rb, rc, ra, op)) |
| 431 | luaG_aritherror(L, rb, rc); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | /* |
no test coverage detected