From 534c3a64d3b47585b415f229aa03af35f9a4796e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 25 Apr 2000 13:55:09 -0300 Subject: small optimizations for table access --- lbuiltin.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lbuiltin.c') diff --git a/lbuiltin.c b/lbuiltin.c index 502c70c8..d57f9fa2 100644 --- a/lbuiltin.c +++ b/lbuiltin.c @@ -1,5 +1,5 @@ /* -** $Id: lbuiltin.c,v 1.105 2000/04/14 17:44:20 roberto Exp roberto $ +** $Id: lbuiltin.c,v 1.106 2000/04/17 19:23:12 roberto Exp roberto $ ** Built-in functions ** See Copyright Notice in lua.h */ @@ -321,7 +321,7 @@ void luaB_call (lua_State *L) { /* push arg[1...n] */ luaD_checkstack(L, narg); for (i=0; itop++) = *luaH_getint(L, arg, i+1); + *(L->top++) = *luaH_getnum(arg, i+1); status = lua_callfunction(L, f); if (err != LUA_NOOBJECT) { /* restore old error method */ lua_pushobject(L, err); @@ -434,7 +434,7 @@ void luaB_foreachi (lua_State *L) { for (i=1; i<=n; i++) { *(L->top++) = *f; ttype(L->top) = TAG_NUMBER; nvalue(L->top++) = i; - *(L->top++) = *luaH_getint(L, t, i); + *(L->top++) = *luaH_getnum(t, i); luaD_call(L, L->top-3, 1); if (ttype(L->top-1) != TAG_NIL) return; @@ -513,7 +513,7 @@ void luaB_tremove (lua_State *L) { int n = (int)getnarg(L, a); int pos = luaL_opt_int(L, 2, n); if (n <= 0) return; /* table is "empty" */ - luaA_pushobject(L, luaH_getint(L, a, pos)); /* result = a[pos] */ + luaA_pushobject(L, luaH_getnum(a, pos)); /* result = a[pos] */ for ( ;pos= P */ - while (sort_comp(L, f, luaH_getint(L, a, ++i), P)) + while (sort_comp(L, f, luaH_getnum(a, ++i), P)) if (i>u) lua_error(L, "invalid order function for sorting"); /* repeat j-- until a[j] <= P */ - while (sort_comp(L, f, P, luaH_getint(L, a, --j))) + while (sort_comp(L, f, P, luaH_getnum(a, --j))) if (j