aboutsummaryrefslogtreecommitdiff
path: root/lvm.h
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.h')
-rw-r--r--lvm.h36
1 files changed, 13 insertions, 23 deletions
diff --git a/lvm.h b/lvm.h
index c74c81f8..54ee5dd7 100644
--- a/lvm.h
+++ b/lvm.h
@@ -78,35 +78,25 @@ typedef enum {
78/* 78/*
79** fast track for 'gettable' 79** fast track for 'gettable'
80*/ 80*/
81#define luaV_fastget(t,k,res,f, aux) \ 81#define luaV_fastget(t,k,res,f, hres) \
82 (aux = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, res))) 82 (hres = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, res)))
83 83
84 84
85/* 85/*
86** Special case of 'luaV_fastget' for integers, inlining the fast case 86** Special case of 'luaV_fastget' for integers, inlining the fast case
87** of 'luaH_getint'. 87** of 'luaH_getint'.
88*/ 88*/
89#define luaV_fastgeti(t,k,res,aux) \ 89#define luaV_fastgeti(t,k,res,hres) \
90 if (!ttistable(t)) aux = HNOTATABLE; \ 90 if (!ttistable(t)) hres = HNOTATABLE; \
91 else { Table *h = hvalue(t); lua_Unsigned u = l_castS2U(k); \ 91 else { luaH_fastgeti(hvalue(t), k, res, hres); }
92 if ((u - 1u < h->alimit)) { \ 92
93 int tag = *getArrTag(h,(u)-1u); \ 93
94 if (tagisempty(tag)) aux = HNOTFOUND; \ 94#define luaV_fastset(t,k,val,hres,f) \
95 else { farr2val(h, u, tag, res); aux = HOK; }} \ 95 (hres = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, val)))
96 else { aux = luaH_getint(h, u, res); }} 96
97 97#define luaV_fastseti(t,k,val,hres) \
98 98 if (!ttistable(t)) hres = HNOTATABLE; \
99#define luaV_fastset(t,k,val,aux,f) \ 99 else { luaH_fastseti(hvalue(t), k, val, hres); }
100 (aux = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, val)))
101
102#define luaV_fastseti(t,k,val,aux) \
103 if (!ttistable(t)) aux = HNOTATABLE; \
104 else { Table *h = hvalue(t); lua_Unsigned u = l_castS2U(k); \
105 if ((u - 1u < h->alimit)) { \
106 lu_byte *tag = getArrTag(h,(u)-1u); \
107 if (tagisempty(*tag)) aux = ~cast_int(u); \
108 else { fval2arr(h, u, tag, val); aux = HOK; }} \
109 else { aux = luaH_psetint(h, u, val); }}
110 100
111 101
112/* 102/*