new implementation of hash tables.

This commit is contained in:
Roberto Ierusalimschy
1999-10-14 17:13:31 -02:00
parent b6ebbb2fee
commit 4e9f2d13d5
9 changed files with 287 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lobject.h,v 1.31 1999/10/04 17:51:04 roberto Exp roberto $
** $Id: lobject.h,v 1.32 1999/10/11 16:13:11 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@@ -162,27 +162,30 @@ typedef struct Closure {
typedef struct node {
TObject ref;
TObject key;
TObject val;
struct node *next; /* for chaining */
} Node;
typedef struct Hash {
int htag;
Node *node;
unsigned int size;
Node *firstfree; /* this position is free; all positions after it are full */
struct Hash *next;
int marked;
Node *node;
int nhash;
int nuse;
int htag;
} Hash;
extern const char *const luaO_typenames[];
#define luaO_typename(o) luaO_typenames[-ttype(o)]
extern const TObject luaO_nilobject;
#define luaO_equalObj(t1,t2) ((ttype(t1) != ttype(t2)) ? 0 \
: luaO_equalval(t1,t2))
int luaO_equalval (const TObject *t1, const TObject *t2);