diff options
| -rw-r--r-- | lvm.c | 18 |
1 files changed, 2 insertions, 16 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.202 2014/04/29 20:06:05 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.203 2014/04/30 16:50:16 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 | */ |
| @@ -127,20 +127,6 @@ int luaV_tointeger_ (const TValue *obj, lua_Integer *p) { | |||
| 127 | 127 | ||
| 128 | 128 | ||
| 129 | /* | 129 | /* |
| 130 | ** Check whether the limit of a 'for' loop can be safely converted | ||
| 131 | ** to an integer (rounding down or up depending on the signal of 'step') | ||
| 132 | */ | ||
| 133 | static int limittointeger (const TValue *n, lua_Integer *p, lua_Integer step) { | ||
| 134 | if (ttisinteger(n)) { | ||
| 135 | *p = ivalue(n); | ||
| 136 | return 1; | ||
| 137 | } | ||
| 138 | else | ||
| 139 | return tointeger_aux(n, p, (step < 0)); | ||
| 140 | } | ||
| 141 | |||
| 142 | |||
| 143 | /* | ||
| 144 | ** Convert a number object to a string | 130 | ** Convert a number object to a string |
| 145 | */ | 131 | */ |
| 146 | int luaV_tostring (lua_State *L, StkId obj) { | 132 | int luaV_tostring (lua_State *L, StkId obj) { |
| @@ -995,7 +981,7 @@ void luaV_execute (lua_State *L) { | |||
| 995 | TValue *pstep = ra + 2; | 981 | TValue *pstep = ra + 2; |
| 996 | lua_Integer ilimit; | 982 | lua_Integer ilimit; |
| 997 | if (ttisinteger(init) && ttisinteger(pstep) && | 983 | if (ttisinteger(init) && ttisinteger(pstep) && |
| 998 | limittointeger(plimit, &ilimit, ivalue(pstep))) { | 984 | tointeger_aux(plimit, &ilimit, (ivalue(pstep) < 0))) { |
| 999 | /* all values are integer */ | 985 | /* all values are integer */ |
| 1000 | setivalue(init, ivalue(init) - ivalue(pstep)); | 986 | setivalue(init, ivalue(init) - ivalue(pstep)); |
| 1001 | setivalue(plimit, ilimit); | 987 | setivalue(plimit, ilimit); |
