diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-30 16:29:51 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-30 16:29:51 -0300 |
| commit | ddff6ecf305e6da4f275b473ef6b66811848a3c6 (patch) | |
| tree | ce167901e8f1746cd3ba9a2ea9fa8242a6b141d6 | |
| parent | 6b630c0fa0e81ce8c259ab9945604803f04fac3d (diff) | |
| download | lua-ddff6ecf305e6da4f275b473ef6b66811848a3c6.tar.gz lua-ddff6ecf305e6da4f275b473ef6b66811848a3c6.tar.bz2 lua-ddff6ecf305e6da4f275b473ef6b66811848a3c6.zip | |
function 'limittointeger' no needed (now that 'tointeger_aux' handles
integers too)
| -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); |
