mirror of
https://github.com/lua/lua.git
synced 2025-02-04 06:13:04 +08:00
detail
This commit is contained in:
parent
445eda7ead
commit
409ee99900
7
ltable.c
7
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)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -557,9 +557,8 @@ int luaH_getn (Table *t) {
|
|||||||
unsigned int j = t->sizearray;
|
unsigned int j = t->sizearray;
|
||||||
if (j > 0 && ttisnil(&t->array[j - 1])) {
|
if (j > 0 && ttisnil(&t->array[j - 1])) {
|
||||||
/* there is a boundary in the array part: (binary) search for it */
|
/* there is a boundary in the array part: (binary) search for it */
|
||||||
unsigned int i = 1;
|
unsigned int i = 0;
|
||||||
if (ttisnil(&t->array[1 - 1])) return 0;
|
while (j - i > 1) {
|
||||||
while (i < j - 1) {
|
|
||||||
unsigned int m = (i+j)/2;
|
unsigned int m = (i+j)/2;
|
||||||
if (ttisnil(&t->array[m - 1])) j = m;
|
if (ttisnil(&t->array[m - 1])) j = m;
|
||||||
else i = m;
|
else i = m;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user