46#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1)
54#define MAXASIZE luaM_limitN(1u << MAXABITS, TValue)
60#define MAXHBITS (MAXABITS - 1)
68#define MAXHSIZE luaM_limitN(1u << MAXHBITS, Node)
75#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t))))
81#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1))))
84#define hashstr(t,str) hashpow2(t, (str)->hash)
85#define hashboolean(t,p) hashpow2(t, p)
87#define hashint(t,i) hashpow2(t, i)
90#define hashpointer(t,p) hashmod(t, point2uint(p))
93#define dummynode (&dummynode_)
118#if !defined(l_hashfloat)
235#define limitequalsasize(t) (isrealasize(t) || ispow2((t)->alimit))
245 unsigned int size = t->
alimit;
251 size |= (size >> 16);
252#if (UINT_MAX >> 30) > 3
253 size |= (size >> 32);
279#define limitasasize(t) check_exp(isrealasize(t), t->alimit)
321 unsigned int asize) {
333 return (i + 1) + asize;
341 for (; i < asize; i++) {
380static unsigned int computesizes (
unsigned int nums[],
unsigned int *pna) {
385 unsigned int optimal = 0;
387 for (i = 0, twotoi = 1;
388 twotoi > 0 && *pna > twotoi / 2;
396 lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal);
421 unsigned int ause = 0;
425 for (lg = 0, ttlg = 1; lg <=
MAXABITS; lg++, ttlg *= 2) {
427 unsigned int lim = ttlg;
434 for (; i <= lim; i++) {
482 for (i = 0; i < (int)size; i++) {
500 for (j = 0; j < size; j++) {
543 unsigned int nhsize) {
550 if (newasize < oldasize) {
554 for (i = newasize; i < oldasize; i++) {
563 if (l_unlikely(newarray ==
NULL && newasize > 0)) {
571 for (i = oldasize; i < newasize; i++)
593 for (i = 0; i <=
MAXABITS; i++) nums[i] = 0;
685 while (othern +
gnext(othern) != mp)
686 othern +=
gnext(othern);
689 if (
gnext(mp) != 0) {
721 return &t->
array[key - 1];
726 return &t->
array[key - 1];
872 unsigned int m = (i + j) / 2;
873 if (
isempty(&array[m - 1])) j = m;
913 unsigned int limit = t->
alimit;
961#if defined(LUA_DEBUG)
void luaG_runerror(lua_State *L, const char *fmt,...)
#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)
int(* lua_CFunction)(lua_State *L)
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)
int luaS_eqlngstr(TString *a, TString *b)
LUA_UNSIGNED lua_Unsigned
#define setnodekey(L, key, obj)
#define setivalue(obj, x)
unsigned int luaS_hashlongstr(TString *ts)
#define lua_numbertointeger(n, p)
#define keyisshrstr(node)
#define LUA_VLIGHTUSERDATA
#define setnorealasize(t)
#define getnodekey(L, obj, node)
#define keyisinteger(node)
static const TValue * getgeneric(Table *t, const TValue *key, int deadok)
static int ispow2realasize(const Table *t)
static Node * mainpositionTV(const Table *t, const TValue *key)
const TValue * luaH_get(Table *t, const TValue *key)
static unsigned int setlimittosize(Table *t)
static unsigned int computesizes(unsigned int nums[], unsigned int *pna)
static lua_Unsigned hash_search(Table *t, lua_Unsigned j)
void luaH_set(lua_State *L, Table *t, const TValue *key, TValue *value)
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)
static int countint(lua_Integer key, unsigned int *nums)
Table * luaH_new(lua_State *L)
static Node * mainposition(const Table *t, int ktt, const Value *kvl)
void luaH_newkey(lua_State *L, Table *t, const TValue *key, TValue *value)
static unsigned int arrayindex(lua_Integer k)
void luaH_finishset(lua_State *L, Table *t, const TValue *key, const TValue *slot, TValue *value)
static const TValue absentkey
LUAI_FUNC unsigned int luaH_realasize(const Table *t)
static unsigned int findindex(lua_State *L, Table *t, TValue *key, unsigned int asize)
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)
static void freehash(lua_State *L, Table *t)
void luaH_resize(lua_State *L, Table *t, unsigned int newasize, unsigned int nhsize)
const TValue * luaH_getint(Table *t, lua_Integer key)
#define hashpointer(t, p)
void luaH_free(lua_State *L, Table *t)
static int l_hashfloat(lua_Number n)
#define limitequalsasize(t)
static void reinsert(lua_State *L, Table *ot, Table *t)
const TValue * luaH_getshortstr(Table *t, TString *key)
static void rehash(lua_State *L, Table *t, const TValue *ek)
static unsigned int binsearch(const TValue *array, unsigned int i, unsigned int j)
static void exchangehashpart(Table *t1, Table *t2)
void luaH_resizearray(lua_State *L, Table *t, unsigned int nasize)
static void setnodevector(lua_State *L, Table *t, unsigned int size)
static int equalkey(const TValue *k1, const Node *n2, int deadok)
int luaV_flttointeger(lua_Number n, lua_Integer *p, F2Imod mode)