MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaV_arith

Function luaV_arith

freebsd/contrib/openzfs/module/lua/lvm.c:410–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408 */
409
410void 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/*

Callers 2

luaV_executeFunction · 0.85
lua_arithFunction · 0.85

Calls 6

luaV_divFunction · 0.85
luaV_modFunction · 0.85
luaO_arithFunction · 0.85
luaV_tonumberFunction · 0.70
call_binTMFunction · 0.70
luaG_aritherrorFunction · 0.70

Tested by

no test coverage detected