diff options
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -89,6 +89,10 @@ typedef enum { | |||
89 | !isempty(slot))) /* result not empty? */ | 89 | !isempty(slot))) /* result not empty? */ |
90 | 90 | ||
91 | 91 | ||
92 | #define luaV_fastget1(t,k,res,f, aux) \ | ||
93 | (aux = (!ttistable(t) ? HNOTATABLE : f(hvalue(t), k, res))) | ||
94 | |||
95 | |||
92 | /* | 96 | /* |
93 | ** Special case of 'luaV_fastget' for integers, inlining the fast case | 97 | ** Special case of 'luaV_fastget' for integers, inlining the fast case |
94 | ** of 'luaH_getint'. | 98 | ** of 'luaH_getint'. |
@@ -100,6 +104,15 @@ typedef enum { | |||
100 | ? &hvalue(t)->array[k - 1] : luaH_getint(hvalue(t), k), \ | 104 | ? &hvalue(t)->array[k - 1] : luaH_getint(hvalue(t), k), \ |
101 | !isempty(slot))) /* result not empty? */ | 105 | !isempty(slot))) /* result not empty? */ |
102 | 106 | ||
107 | #define luaV_fastgeti1(t,k,val,aux) \ | ||
108 | if (!ttistable(t)) aux = HNOTATABLE; \ | ||
109 | else { Table *h = hvalue(t); lua_Unsigned u = l_castS2U(k); \ | ||
110 | if ((u - 1u < h->alimit)) { \ | ||
111 | int tag = *getArrTag(h,u); \ | ||
112 | if (tagisempty(tag)) aux = HNOTFOUND; \ | ||
113 | else { arr2val(h, u, tag, val); aux = HOK; }} \ | ||
114 | else { aux = luaH_getint1(h, u, val); }} | ||
115 | |||
103 | 116 | ||
104 | /* | 117 | /* |
105 | ** Finish a fast set operation (when fast get succeeds). In that case, | 118 | ** Finish a fast set operation (when fast get succeeds). In that case, |
@@ -125,8 +138,8 @@ LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode); | |||
125 | LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, | 138 | LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, |
126 | F2Imod mode); | 139 | F2Imod mode); |
127 | LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode); | 140 | LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode); |
128 | LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, | 141 | LUAI_FUNC void luaV_finishget1 (lua_State *L, const TValue *t, TValue *key, |
129 | StkId val, const TValue *slot); | 142 | StkId val, int aux); |
130 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, | 143 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, |
131 | TValue *val, const TValue *slot); | 144 | TValue *val, const TValue *slot); |
132 | LUAI_FUNC void luaV_finishOp (lua_State *L); | 145 | LUAI_FUNC void luaV_finishOp (lua_State *L); |