summaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-01-13 16:06:27 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-01-13 16:06:27 -0200
commit5981161360e054b8e7e6e670f6ec8d0a2add7f3b (patch)
tree0199ba9cea7f34488e07fe05743d26e88875681c /ltable.c
parent763c64be9bcdb3af225f547856af50fcc4cfc544 (diff)
downloadlua-github-5981161360e054b8e7e6e670f6ec8d0a2add7f3b.tar.gz
small optimizations (?)
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ltable.c b/ltable.c
index 0c91833a..df5b7a5a 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltable.c,v 1.9 1997/12/15 16:17:20 roberto Exp roberto $
+** $Id: ltable.c,v 1.10 1998/01/09 14:44:55 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -65,7 +65,8 @@ static int present (Hash *t, TObject *key)
if (ttype(rf) != LUA_T_NIL && !luaO_equalObj(key, rf)) {
int h2 = h%(tsize-2) + 1;
do {
- h1 = (h1+h2)%tsize;
+ h1 += h2;
+ if (h1 >= tsize) h1 -= tsize;
rf = ref(node(t, h1));
} while (ttype(rf) != LUA_T_NIL && !luaO_equalObj(key, rf));
}