New table API for 'set' functions
This commit is contained in:
25
lvm.h
25
lvm.h
@@ -104,14 +104,27 @@ typedef enum {
|
||||
? &hvalue(t)->array[k - 1] : luaH_getint(hvalue(t), k), \
|
||||
!isempty(slot))) /* result not empty? */
|
||||
|
||||
#define luaV_fastgeti1(t,k,val,aux) \
|
||||
#define luaV_fastgeti1(t,k,res,aux) \
|
||||
if (!ttistable(t)) aux = HNOTATABLE; \
|
||||
else { Table *h = hvalue(t); lua_Unsigned u = l_castS2U(k); \
|
||||
if ((u - 1u < h->alimit)) { \
|
||||
int tag = *getArrTag(h,u); \
|
||||
if (tagisempty(tag)) aux = HNOTFOUND; \
|
||||
else { arr2val(h, u, tag, val); aux = HOK; }} \
|
||||
else { aux = luaH_getint1(h, u, val); }}
|
||||
else { arr2val(h, u, tag, res); aux = HOK; }} \
|
||||
else { aux = luaH_getint1(h, u, res); }}
|
||||
|
||||
|
||||
#define luaV_fastset1(t,k,val,aux,f) \
|
||||
(aux = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, val)))
|
||||
|
||||
#define luaV_fastseti1(t,k,val,aux) \
|
||||
if (!ttistable(t)) aux = HNOTATABLE; \
|
||||
else { Table *h = hvalue(t); lua_Unsigned u = l_castS2U(k); \
|
||||
if ((u - 1u < h->alimit)) { \
|
||||
lu_byte *tag = getArrTag(h,u); \
|
||||
if (tagisempty(*tag)) aux = ~cast_int(u); \
|
||||
else { val2arr(h, u, tag, val); aux = HOK; }} \
|
||||
else { aux = luaH_setint1(h, u, val); }}
|
||||
|
||||
|
||||
/*
|
||||
@@ -122,6 +135,8 @@ typedef enum {
|
||||
{ setobj2t(L, cast(TValue *,slot), v); \
|
||||
luaC_barrierback(L, gcvalue(t), v); }
|
||||
|
||||
#define luaV_finishfastset1(L,t,v) luaC_barrierback(L, gcvalue(t), v)
|
||||
|
||||
|
||||
/*
|
||||
** Shift right is the same as shift left with a negative 'y'
|
||||
@@ -140,8 +155,8 @@ LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p,
|
||||
LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode);
|
||||
LUAI_FUNC void luaV_finishget1 (lua_State *L, const TValue *t, TValue *key,
|
||||
StkId val, int aux);
|
||||
LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
|
||||
TValue *val, const TValue *slot);
|
||||
LUAI_FUNC void luaV_finishset1 (lua_State *L, const TValue *t, TValue *key,
|
||||
TValue *val, int aux);
|
||||
LUAI_FUNC void luaV_finishOp (lua_State *L);
|
||||
LUAI_FUNC void luaV_execute (lua_State *L, CallInfo *ci);
|
||||
LUAI_FUNC void luaV_concat (lua_State *L, int total);
|
||||
|
||||
Reference in New Issue
Block a user