From 409ee99900216d4a64a9a7029099bc7ae67a4d8e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 1 Apr 2005 10:51:37 -0300 Subject: detail --- ltable.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ltable.c') diff --git a/ltable.c b/ltable.c index eaf4ea7d..ab69c343 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.18 2005/03/09 16:28:07 roberto Exp roberto $ +** $Id: ltable.c,v 2.19 2005/03/16 16:58:41 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -557,9 +557,8 @@ int luaH_getn (Table *t) { unsigned int j = t->sizearray; if (j > 0 && ttisnil(&t->array[j - 1])) { /* there is a boundary in the array part: (binary) search for it */ - unsigned int i = 1; - if (ttisnil(&t->array[1 - 1])) return 0; - while (i < j - 1) { + unsigned int i = 0; + while (j - i > 1) { unsigned int m = (i+j)/2; if (ttisnil(&t->array[m - 1])) j = m; else i = m; -- cgit v1.2.3-55-g6feb