commit ddff6ecf305e6da4f275b473ef6b66811848a3c6
parent 6b630c0fa0e81ce8c259ab9945604803f04fac3d
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 30 Apr 2014 16:29:26 -0300
function 'limittointeger' no needed (now that 'tointeger_aux' handles
integers too)
Diffstat:
M | lvm.c | | | 18 | ++---------------- |
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/lvm.c b/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 2.202 2014/04/29 20:06:05 roberto Exp roberto $
+** $Id: lvm.c,v 2.203 2014/04/30 16:50:16 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -127,20 +127,6 @@ int luaV_tointeger_ (const TValue *obj, lua_Integer *p) {
/*
-** Check whether the limit of a 'for' loop can be safely converted
-** to an integer (rounding down or up depending on the signal of 'step')
-*/
-static int limittointeger (const TValue *n, lua_Integer *p, lua_Integer step) {
- if (ttisinteger(n)) {
- *p = ivalue(n);
- return 1;
- }
- else
- return tointeger_aux(n, p, (step < 0));
-}
-
-
-/*
** Convert a number object to a string
*/
int luaV_tostring (lua_State *L, StkId obj) {
@@ -995,7 +981,7 @@ void luaV_execute (lua_State *L) {
TValue *pstep = ra + 2;
lua_Integer ilimit;
if (ttisinteger(init) && ttisinteger(pstep) &&
- limittointeger(plimit, &ilimit, ivalue(pstep))) {
+ tointeger_aux(plimit, &ilimit, (ivalue(pstep) < 0))) {
/* all values are integer */
setivalue(init, ivalue(init) - ivalue(pstep));
setivalue(plimit, ilimit);