3 ** Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h
11 #define hsize2hbits(s) ((s) ? ((s)==1 ? 1 : 1+lj_fls((uint32_t)((s)-1))) : 0)
13 LJ_FUNCA GCtab
*lj_tab_new(lua_State
*L
, uint32_t asize
, uint32_t hbits
);
14 LJ_FUNC GCtab
* LJ_FASTCALL
lj_tab_new1(lua_State
*L
, uint32_t ahsize
);
15 LJ_FUNCA GCtab
* LJ_FASTCALL
lj_tab_dup(lua_State
*L
, const GCtab
*kt
);
16 LJ_FUNC
void LJ_FASTCALL
lj_tab_free(global_State
*g
, GCtab
*t
);
17 LJ_FUNCA
void lj_tab_reasize(lua_State
*L
, GCtab
*t
, uint32_t nasize
);
19 /* Caveat: all getters except lj_tab_get() can return NULL! */
21 LJ_FUNCA cTValue
* LJ_FASTCALL
lj_tab_getinth(GCtab
*t
, int32_t key
);
22 LJ_FUNC cTValue
*lj_tab_getstr(GCtab
*t
, GCstr
*key
);
23 LJ_FUNCA cTValue
*lj_tab_get(lua_State
*L
, GCtab
*t
, cTValue
*key
);
25 /* Caveat: all setters require a write barrier for the stored value. */
27 LJ_FUNCA TValue
*lj_tab_newkey(lua_State
*L
, GCtab
*t
, cTValue
*key
);
28 LJ_FUNC TValue
*lj_tab_setinth(lua_State
*L
, GCtab
*t
, int32_t key
);
29 LJ_FUNC TValue
*lj_tab_setstr(lua_State
*L
, GCtab
*t
, GCstr
*key
);
30 LJ_FUNC TValue
*lj_tab_set(lua_State
*L
, GCtab
*t
, cTValue
*key
);
32 #define inarray(t, key) ((MSize)(key) < (MSize)(t)->asize)
33 #define arrayslot(t, i) (&tvref((t)->array)[(i)])
34 #define lj_tab_getint(t, key) \
35 (inarray((t), (key)) ? arrayslot((t), (key)) : lj_tab_getinth((t), (key)))
36 #define lj_tab_setint(L, t, key) \
37 (inarray((t), (key)) ? arrayslot((t), (key)) : lj_tab_setinth(L, (t), (key)))
39 LJ_FUNCA
int lj_tab_next(lua_State
*L
, GCtab
*t
, TValue
*key
);
40 LJ_FUNCA MSize LJ_FASTCALL
lj_tab_len(GCtab
*t
);