aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/ltable.c b/ltable.c
index 6eb5f3e3..c5f48716 100644
--- a/ltable.c
+++ b/ltable.c
@@ -665,7 +665,7 @@ static void reinsertOldSlice (lua_State *L, Table *t, unsigned oldasize,
665 int tag = *getArrTag(t, i); 665 int tag = *getArrTag(t, i);
666 if (!tagisempty(tag)) { /* a non-empty entry? */ 666 if (!tagisempty(tag)) { /* a non-empty entry? */
667 TValue aux; 667 TValue aux;
668 farr2val(t, i + 1, tag, &aux); 668 farr2val(t, i + 1, tag, &aux); /* copy entry into 'aux' */
669 luaH_setint(L, t, i + 1, &aux); /* re-insert it into the table */ 669 luaH_setint(L, t, i + 1, &aux); /* re-insert it into the table */
670 } 670 }
671 } 671 }
@@ -673,21 +673,12 @@ static void reinsertOldSlice (lua_State *L, Table *t, unsigned oldasize,
673} 673}
674 674
675 675
676#define BK1(x) cast(lua_Unsigned, ((x) << 8) | LUA_VEMPTY)
677
678/* 676/*
679** Clear new slice of the array, in bulk. 677** Clear new slice of the array.
680*/ 678*/
681static void clearNewSlice (Table *t, unsigned oldasize, unsigned newasize) { 679static void clearNewSlice (Table *t, unsigned oldasize, unsigned newasize) {
682 int i, j; 680 for (; oldasize < newasize; oldasize++)
683 int firstcell = (oldasize + NM - 1) / NM; 681 *getArrTag(t, oldasize) = LUA_VEMPTY;
684 int lastcell = cast_int((newasize + NM - 1) / NM) - 1;
685 for (i = firstcell; i <= lastcell; i++) {
686 /* empty tag repeated for all tags in a word */
687 const lua_Unsigned empty = BK1(BK1(BK1(BK1(BK1(BK1(BK1(BK1(0))))))));
688 for (j = 0; j < BKSZ; j++)
689 t->array[i].u.bulk[j] = empty;
690 }
691} 682}
692 683
693 684