diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-08-14 15:33:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-08-14 15:33:14 -0300 |
commit | ac65bab25f1eaaf70e1826a6937a74b3a55b521b (patch) | |
tree | a8220432c19dde69af92e720008863f821d1ce96 /lvm.c | |
parent | f185c0132e09a5e0a32782c674de75b510f887d8 (diff) | |
download | lua-ac65bab25f1eaaf70e1826a6937a74b3a55b521b.tar.gz lua-ac65bab25f1eaaf70e1826a6937a74b3a55b521b.tar.bz2 lua-ac65bab25f1eaaf70e1826a6937a74b3a55b521b.zip |
jumps in 'for' loops don't need to be signed
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.289 2017/06/29 15:38:41 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.290 2017/07/07 16:34:32 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1335,7 +1335,7 @@ void luaV_execute (lua_State *L) { | |||
1335 | lua_Integer idx = intop(+, ivalue(s2v(ra)), step); /* increment index */ | 1335 | lua_Integer idx = intop(+, ivalue(s2v(ra)), step); /* increment index */ |
1336 | lua_Integer limit = ivalue(s2v(ra + 1)); | 1336 | lua_Integer limit = ivalue(s2v(ra + 1)); |
1337 | if ((0 < step) ? (idx <= limit) : (limit <= idx)) { | 1337 | if ((0 < step) ? (idx <= limit) : (limit <= idx)) { |
1338 | pc += GETARG_sBx(i); /* jump back */ | 1338 | pc -= GETARG_Bx(i); /* jump back */ |
1339 | chgivalue(s2v(ra), idx); /* update internal index... */ | 1339 | chgivalue(s2v(ra), idx); /* update internal index... */ |
1340 | setivalue(s2v(ra + 3), idx); /* ...and external index */ | 1340 | setivalue(s2v(ra + 3), idx); /* ...and external index */ |
1341 | } | 1341 | } |
@@ -1347,7 +1347,7 @@ void luaV_execute (lua_State *L) { | |||
1347 | idx = luai_numadd(L, idx, step); /* inc. index */ | 1347 | idx = luai_numadd(L, idx, step); /* inc. index */ |
1348 | if (luai_numlt(0, step) ? luai_numle(idx, limit) | 1348 | if (luai_numlt(0, step) ? luai_numle(idx, limit) |
1349 | : luai_numle(limit, idx)) { | 1349 | : luai_numle(limit, idx)) { |
1350 | pc += GETARG_sBx(i); /* jump back */ | 1350 | pc -= GETARG_Bx(i); /* jump back */ |
1351 | chgfltvalue(s2v(ra), idx); /* update internal index... */ | 1351 | chgfltvalue(s2v(ra), idx); /* update internal index... */ |
1352 | setfltvalue(s2v(ra + 3), idx); /* ...and external index */ | 1352 | setfltvalue(s2v(ra + 3), idx); /* ...and external index */ |
1353 | } | 1353 | } |
@@ -1381,7 +1381,7 @@ void luaV_execute (lua_State *L) { | |||
1381 | luaG_runerror(L, "'for' initial value must be a number"); | 1381 | luaG_runerror(L, "'for' initial value must be a number"); |
1382 | setfltvalue(init, luai_numsub(L, ninit, nstep)); | 1382 | setfltvalue(init, luai_numsub(L, ninit, nstep)); |
1383 | } | 1383 | } |
1384 | pc += GETARG_sBx(i); | 1384 | pc += GETARG_Bx(i); |
1385 | vmbreak; | 1385 | vmbreak; |
1386 | } | 1386 | } |
1387 | vmcase(OP_TFORCALL) { | 1387 | vmcase(OP_TFORCALL) { |
@@ -1401,7 +1401,7 @@ void luaV_execute (lua_State *L) { | |||
1401 | l_tforloop: | 1401 | l_tforloop: |
1402 | if (!ttisnil(s2v(ra + 1))) { /* continue loop? */ | 1402 | if (!ttisnil(s2v(ra + 1))) { /* continue loop? */ |
1403 | setobjs2s(L, ra, ra + 1); /* save control variable */ | 1403 | setobjs2s(L, ra, ra + 1); /* save control variable */ |
1404 | pc += GETARG_sBx(i); /* jump back */ | 1404 | pc -= GETARG_Bx(i); /* jump back */ |
1405 | } | 1405 | } |
1406 | vmbreak; | 1406 | vmbreak; |
1407 | } | 1407 | } |