new type `boolean'

This commit is contained in:
Roberto Ierusalimschy
2001-12-11 20:48:44 -02:00
parent ed9be5e1f0
commit 9aff171f3b
18 changed files with 166 additions and 121 deletions

View File

@@ -52,6 +52,7 @@
#define hashnum(t,n) \
(node(t, lmod(cast(lu_hash, cast(ls_hash, n)), sizenode(t))))
#define hashstr(t,str) (node(t, lmod((str)->tsv.hash, sizenode(t))))
#define hashboolean(t,p) (node(t, lmod(p, sizenode(t))))
#define hashpointer(t,p) (node(t, lmod(IntPoint(p), sizenode(t))))
@@ -65,6 +66,8 @@ Node *luaH_mainposition (const Table *t, const TObject *key) {
return hashnum(t, nvalue(key));
case LUA_TSTRING:
return hashstr(t, tsvalue(key));
case LUA_TBOOLEAN:
return hashboolean(t, bvalue(key));
default: /* all other types are hashed as (void *) */
return hashpointer(t, tsvalue(key));
}