Full implementation of new representation for arrays

This commit is contained in:
Roberto Ierusalimschy
2023-11-03 15:26:13 -03:00
parent 43c8e5bded
commit 08a077d673
5 changed files with 97 additions and 30 deletions

4
lvm.h
View File

@@ -90,7 +90,7 @@ typedef enum {
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); \
int tag = *getArrTag(h,(u)-1u); \
if (tagisempty(tag)) aux = HNOTFOUND; \
else { farr2val(h, u, tag, res); aux = HOK; }} \
else { aux = luaH_getint(h, u, res); }}
@@ -103,7 +103,7 @@ typedef enum {
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); \
lu_byte *tag = getArrTag(h,(u)-1u); \
if (tagisempty(*tag)) aux = ~cast_int(u); \
else { fval2arr(h, u, tag, val); aux = HOK; }} \
else { aux = luaH_psetint(h, u, val); }}