aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/lcode.c b/lcode.c
index 35e0527f..83a6d064 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1730,17 +1730,12 @@ void luaK_fixline (FuncState *fs, int line) {
1730} 1730}
1731 1731
1732 1732
1733void luaK_settablesize (FuncState *fs, int pc, int ra, int rc, int rb) { 1733void luaK_settablesize (FuncState *fs, int pc, int ra, int asize, int hsize) {
1734 Instruction *inst = &fs->f->code[pc]; 1734 Instruction *inst = &fs->f->code[pc];
1735 int extra = 0; 1735 int rb = (hsize != 0) ? luaO_ceillog2(hsize) + 1 : 0; /* hash size */
1736 int k = 0; 1736 int extra = asize / (MAXARG_C + 1); /* higher bits of array size */
1737 if (rb != 0) 1737 int rc = asize % (MAXARG_C + 1); /* lower bits of array size */
1738 rb = luaO_ceillog2(rb) + 1; /* hash size */ 1738 int k = (extra > 0); /* true iff needs extra argument */
1739 if (rc > MAXARG_C) { /* does it need the extra argument? */
1740 extra = rc / (MAXARG_C + 1);
1741 rc %= (MAXARG_C + 1);
1742 k = 1;
1743 }
1744 *inst = CREATE_ABCk(OP_NEWTABLE, ra, rb, rc, k); 1739 *inst = CREATE_ABCk(OP_NEWTABLE, ra, rb, rc, k);
1745 *(inst + 1) = CREATE_Ax(OP_EXTRAARG, extra); 1740 *(inst + 1) = CREATE_Ax(OP_EXTRAARG, extra);
1746} 1741}