46#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1)
47#define MAXASIZE (1u << MAXABITS)
55#define MAXHBITS (MAXABITS - 1)
58#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t))))
60#define hashstr(t,str) hashpow2(t, (str)->hash)
61#define hashboolean(t,p) hashpow2(t, p)
62#define hashint(t,i) hashpow2(t, i)
69#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1))))
72#define hashpointer(t,p) hashmod(t, point2uint(p))
75#define dummynode (&dummynode_)
96#if !defined(l_hashfloat)
106 unsigned int u =
cast(
unsigned int, i) +
cast(
unsigned int, ni);
107 return cast_int(u <=
cast(
unsigned int, INT_MAX) ? u : ~u);
118 switch (
ttype(key)) {
148 return cast(
unsigned int, k);
163 if (i != 0 && i <= t->sizearray)
219static unsigned int computesizes (
unsigned int nums[],
unsigned int *pna) {
224 unsigned int optimal = 0;
226 for (i = 0, twotoi = 1;
227 twotoi > 0 && *pna > twotoi / 2;
237 lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal);
262 unsigned int ause = 0;
265 for (lg = 0, ttlg = 1; lg <=
MAXABITS; lg++, ttlg *= 2) {
267 unsigned int lim = ttlg;
274 for (; i <= lim; i++) {
323 for (i = 0; i < (int)size; i++) {
348 unsigned int nhsize) {
355 if (nasize > oldasize)
358 asn.
t = t; asn.
nhsize = nhsize;
363 if (nasize < oldasize) {
366 for (i=nasize; i<oldasize; i++) {
374 for (j = oldhsize - 1; j >= 0; j--) {
375 Node *old = nold + j;
401 for (i = 0; i <=
MAXABITS; i++) nums[i] = 0;
487 while (othern +
gnext(othern) != mp)
488 othern +=
gnext(othern);
491 if (
gnext(mp) != 0) {
519 return &t->
array[key - 1];
590 switch (
ttype(key)) {
666 unsigned int m = (i+j)/2;
680#if defined(LUA_DEBUG)
void luaG_runerror(lua_State *L, const char *fmt,...)
void luaD_throw(lua_State *L, int errcode)
int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud)
#define luaM_freearray(L, b, n, t)
#define luaM_newvector(L, n, t)
#define luaM_reallocvector(L, v, oldn, n, t)
#define setsvalue(L, obj, x)
#define LUA_TLIGHTUSERDATA
GCObject * luaC_newobj(lua_State *L, int tt, size_t sz, GCObject **list, int offset)
#define luaC_barrierback(L, p, v)
int luaO_ceillog2(unsigned int x)
LUA_UNSIGNED lua_Unsigned
#define luaV_rawequalobj(o1, o2)
#define setnodekey(L, key, obj)
#define setivalue(obj, x)
unsigned int luaS_hashlongstr(TString *ts)
static const TValue * getgeneric(Table *t, const TValue *key)
const TValue * luaH_get(Table *t, const TValue *key)
static unsigned int computesizes(unsigned int nums[], unsigned int *pna)
void luaH_resize(lua_State *L, Table *t, unsigned int nasize, unsigned int nhsize)
static void setarrayvector(lua_State *L, Table *t, unsigned int size)
static Node * getfreepos(Table *t)
const TValue * luaH_getstr(Table *t, TString *key)
static int numusehash(const Table *t, unsigned int *nums, unsigned int *pna)
int luaH_next(lua_State *L, Table *t, StkId key)
Table * luaH_new(lua_State *L)
TValue * luaH_newkey(lua_State *L, Table *t, const TValue *key)
lua_Unsigned luaH_getn(Table *t)
#define hashboolean(t, p)
static const Node dummynode_
void luaH_setint(lua_State *L, Table *t, lua_Integer key, TValue *value)
static unsigned int numusearray(const Table *t, unsigned int *nums)
TValue * luaH_set(lua_State *L, Table *t, const TValue *key)
static Node * mainposition(const Table *t, const TValue *key)
static void auxsetnode(lua_State *L, void *ud)
static unsigned int arrayindex(const TValue *key)
const TValue * luaH_getint(Table *t, lua_Integer key)
#define hashpointer(t, p)
static int countint(const TValue *key, unsigned int *nums)
void luaH_free(lua_State *L, Table *t)
static int l_hashfloat(lua_Number n)
const TValue * luaH_getshortstr(Table *t, TString *key)
static void rehash(lua_State *L, Table *t, const TValue *ek)
static lua_Unsigned unbound_search(Table *t, lua_Unsigned j)
void luaH_resizearray(lua_State *L, Table *t, unsigned int nasize)
static void setnodevector(lua_State *L, Table *t, unsigned int size)
static unsigned int findindex(lua_State *L, Table *t, StkId key)
#define lua_numbertointeger(n, p)
int luaV_tointeger(const TValue *obj, lua_Integer *p, int mode)