diff options
Diffstat (limited to 'ltable.h')
-rw-r--r-- | ltable.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -45,6 +45,25 @@ | |||
45 | #define nodefromval(v) cast(Node *, (v)) | 45 | #define nodefromval(v) cast(Node *, (v)) |
46 | 46 | ||
47 | 47 | ||
48 | |||
49 | #define luaH_fastgeti(t,k,res,hres) \ | ||
50 | { Table *h = t; lua_Unsigned u = l_castS2U(k); \ | ||
51 | if ((u - 1u < h->alimit)) { \ | ||
52 | int tag = *getArrTag(h,(u)-1u); \ | ||
53 | if (tagisempty(tag)) hres = HNOTFOUND; \ | ||
54 | else { farr2val(h, u, tag, res); hres = HOK; }} \ | ||
55 | else { hres = luaH_getint(h, u, res); }} | ||
56 | |||
57 | |||
58 | #define luaH_fastseti(t,k,val,hres) \ | ||
59 | { Table *h = t; lua_Unsigned u = l_castS2U(k); \ | ||
60 | if ((u - 1u < h->alimit)) { \ | ||
61 | lu_byte *tag = getArrTag(h,(u)-1u); \ | ||
62 | if (tagisempty(*tag)) hres = ~cast_int(u); \ | ||
63 | else { fval2arr(h, u, tag, val); hres = HOK; }} \ | ||
64 | else { hres = luaH_psetint(h, u, val); }} | ||
65 | |||
66 | |||
48 | /* results from get/pset */ | 67 | /* results from get/pset */ |
49 | #define HOK 0 | 68 | #define HOK 0 |
50 | #define HNOTFOUND 1 | 69 | #define HNOTFOUND 1 |