MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / Arith

Function Arith

Source/Misc/lua/src/lua.c:15146–15166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

luaV_executeFunction · 0.85

Calls 3

luaV_tonumberFunction · 0.85
call_binTMFunction · 0.85
luaG_aritherrorFunction · 0.85

Tested by

no test coverage detected