|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
** $Id: lvm.c,v 2.185 2014/01/27 13:34:32 roberto Exp roberto $ |
|
|
|
** $Id: lvm.c,v 2.186 2014/02/05 19:14:53 roberto Exp roberto $ |
|
|
|
** Lua virtual machine |
|
|
|
** See Copyright Notice in lua.h |
|
|
|
*/ |
|
|
@ -633,7 +633,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setivalue(ra, intop(+, ib, ic)); |
|
|
|
} |
|
|
|
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
|
|
|
setnvalue(ra, luai_numadd(nb, nc)); |
|
|
|
setnvalue(ra, luai_numadd(L, nb, nc)); |
|
|
|
} |
|
|
|
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } |
|
|
|
) |
|
|
@ -646,7 +646,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setivalue(ra, intop(-, ib, ic)); |
|
|
|
} |
|
|
|
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
|
|
|
setnvalue(ra, luai_numsub(nb, nc)); |
|
|
|
setnvalue(ra, luai_numsub(L, nb, nc)); |
|
|
|
} |
|
|
|
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } |
|
|
|
) |
|
|
@ -659,7 +659,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setivalue(ra, intop(*, ib, ic)); |
|
|
|
} |
|
|
|
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
|
|
|
setnvalue(ra, luai_nummul(nb, nc)); |
|
|
|
setnvalue(ra, luai_nummul(L, nb, nc)); |
|
|
|
} |
|
|
|
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } |
|
|
|
) |
|
|
@ -668,7 +668,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
TValue *rc = RKC(i); |
|
|
|
lua_Number nb; lua_Number nc; |
|
|
|
if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
|
|
|
setnvalue(ra, luai_numdiv(nb, nc)); |
|
|
|
setnvalue(ra, luai_numdiv(L, nb, nc)); |
|
|
|
} |
|
|
|
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } |
|
|
|
) |
|
|
@ -735,7 +735,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setivalue(ra, luaV_mod(L, ib, ic)); |
|
|
|
} |
|
|
|
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
|
|
|
setnvalue(ra, luai_nummod(nb, nc)); |
|
|
|
setnvalue(ra, luai_nummod(L, nb, nc)); |
|
|
|
} |
|
|
|
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } |
|
|
|
) |
|
|
@ -748,7 +748,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setivalue(ra, luaV_pow(L, ib, ic)); |
|
|
|
} |
|
|
|
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { |
|
|
|
setnvalue(ra, luai_numpow(nb, nc)); |
|
|
|
setnvalue(ra, luai_numpow(L, nb, nc)); |
|
|
|
} |
|
|
|
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } |
|
|
|
) |
|
|
@ -760,7 +760,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setivalue(ra, intop(-, 0, ib)); |
|
|
|
} |
|
|
|
else if (tonumber(rb, &nb)) { |
|
|
|
setnvalue(ra, luai_numunm(nb)); |
|
|
|
setnvalue(ra, luai_numunm(L, nb)); |
|
|
|
} |
|
|
|
else { |
|
|
|
Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); |
|
|
@ -911,10 +911,10 @@ void luaV_execute (lua_State *L) { |
|
|
|
} |
|
|
|
else { /* floating count */ |
|
|
|
lua_Number step = fltvalue(ra + 2); |
|
|
|
lua_Number idx = luai_numadd(fltvalue(ra), step); /* inc. index */ |
|
|
|
lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ |
|
|
|
lua_Number limit = fltvalue(ra + 1); |
|
|
|
if (luai_numlt(0, step) ? luai_numle(idx, limit) |
|
|
|
: luai_numle(limit, idx)) { |
|
|
|
: luai_numle(limit, idx)) { |
|
|
|
ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ |
|
|
|
setnvalue(ra, idx); /* update internal index... */ |
|
|
|
setnvalue(ra + 3, idx); /* ...and external index */ |
|
|
@ -938,7 +938,7 @@ void luaV_execute (lua_State *L) { |
|
|
|
setnvalue(pstep, nstep); |
|
|
|
if (!tonumber(init, &ninit)) |
|
|
|
luaG_runerror(L, LUA_QL("for") " initial value must be a number"); |
|
|
|
setnvalue(ra, luai_numsub(ninit, nstep)); |
|
|
|
setnvalue(ra, luai_numsub(L, ninit, nstep)); |
|
|
|
} |
|
|
|
ci->u.l.savedpc += GETARG_sBx(i); |
|
|
|
) |
|
|
|