aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-08 17:10:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-08 17:10:05 -0300
commitf8df21bd2071c4e3729d37d1552f54ca2742551a (patch)
tree6d85e7fd9f86bfb6879c0edd60780b1f40325027 /ltable.c
parentd3902cfa81021bca0a8c30b3ad79a1e2367f6621 (diff)
downloadlua-f8df21bd2071c4e3729d37d1552f54ca2742551a.tar.gz
lua-f8df21bd2071c4e3729d37d1552f54ca2742551a.tar.bz2
lua-f8df21bd2071c4e3729d37d1552f54ca2742551a.zip
`luaconf.h´ exports all its definitions always (so all of them
must have a lua/LUA prefix).
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ltable.c b/ltable.c
index d9c43a7f..4d89b72c 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.15 2005/01/10 18:17:39 roberto Exp roberto $ 2** $Id: ltable.c,v 2.16 2005/03/08 18:09:16 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -38,10 +38,10 @@
38/* 38/*
39** max size of array part is 2^MAXBITS 39** max size of array part is 2^MAXBITS
40*/ 40*/
41#if LUA_BITSINT > 26 41#if LUAC_BITSINT > 26
42#define MAXBITS 26 42#define MAXBITS 26
43#else 43#else
44#define MAXBITS (LUA_BITSINT-2) 44#define MAXBITS (LUAC_BITSINT-2)
45#endif 45#endif
46 46
47#define MAXASIZE (1 << MAXBITS) 47#define MAXASIZE (1 << MAXBITS)
@@ -120,7 +120,7 @@ static int arrayindex (const TValue *key) {
120 lua_Number n = nvalue(key); 120 lua_Number n = nvalue(key);
121 int k; 121 int k;
122 lua_number2int(k, n); 122 lua_number2int(k, n);
123 if (num_eq(cast(lua_Number, k), nvalue(key))) 123 if (luac_numeq(cast(lua_Number, k), nvalue(key)))
124 return k; 124 return k;
125 } 125 }
126 return -1; /* `key' did not match some condition */ 126 return -1; /* `key' did not match some condition */
@@ -437,7 +437,7 @@ const TValue *luaH_getnum (Table *t, int key) {
437 lua_Number nk = cast(lua_Number, key); 437 lua_Number nk = cast(lua_Number, key);
438 Node *n = hashnum(t, nk); 438 Node *n = hashnum(t, nk);
439 do { /* check whether `key' is somewhere in the chain */ 439 do { /* check whether `key' is somewhere in the chain */
440 if (ttisnumber(gkey(n)) && num_eq(nvalue(gkey(n)), nk)) 440 if (ttisnumber(gkey(n)) && luac_numeq(nvalue(gkey(n)), nk))
441 return gval(n); /* that's it */ 441 return gval(n); /* that's it */
442 else n = gnext(n); 442 else n = gnext(n);
443 } while (n); 443 } while (n);
@@ -470,7 +470,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
470 case LUA_TNUMBER: { 470 case LUA_TNUMBER: {
471 int k; 471 int k;
472 lua_number2int(k, (nvalue(key))); 472 lua_number2int(k, (nvalue(key)));
473 if (num_eq(cast(lua_Number, k), nvalue(key))) /* is an integer index? */ 473 if (luac_numeq(cast(lua_Number, k), nvalue(key))) /* index is integer? */
474 return luaH_getnum(t, k); /* use specialized version */ 474 return luaH_getnum(t, k); /* use specialized version */
475 /* else go through */ 475 /* else go through */
476 } 476 }
@@ -494,7 +494,7 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
494 return cast(TValue *, p); 494 return cast(TValue *, p);
495 else { 495 else {
496 if (ttisnil(key)) luaG_runerror(L, "table index is nil"); 496 if (ttisnil(key)) luaG_runerror(L, "table index is nil");
497 else if (ttisnumber(key) && !num_eq(nvalue(key), nvalue(key))) 497 else if (ttisnumber(key) && !luac_numeq(nvalue(key), nvalue(key)))
498 luaG_runerror(L, "table index is NaN"); 498 luaG_runerror(L, "table index is NaN");
499 return newkey(L, t, key); 499 return newkey(L, t, key);
500 } 500 }