diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-02-18 13:02:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-02-18 13:02:56 -0300 |
| commit | 60c83ded3080a23bc661ab440c36d0a71b399e2e (patch) | |
| tree | 0aa24b14c1215541b52e7885fd2f2c41aa128a06 /lparser.c | |
| parent | 07948c3181702c55b7b36069ca519b54371a4ab7 (diff) | |
| download | lua-60c83ded3080a23bc661ab440c36d0a71b399e2e.tar.gz lua-60c83ded3080a23bc661ab440c36d0a71b399e2e.tar.bz2 lua-60c83ded3080a23bc661ab440c36d0a71b399e2e.zip | |
small optimization for sizes of array constructors
Diffstat (limited to 'lparser.c')
| -rw-r--r-- | lparser.c | 5 |
1 files changed, 2 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 1.204 2003/02/11 10:46:24 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.205 2003/02/11 10:49:53 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -515,8 +515,7 @@ static void constructor (LexState *ls, expdesc *t) { | |||
| 515 | } while (testnext(ls, ',') || testnext(ls, ';')); | 515 | } while (testnext(ls, ',') || testnext(ls, ';')); |
| 516 | check_match(ls, '}', '{', line); | 516 | check_match(ls, '}', '{', line); |
| 517 | lastlistfield(fs, &cc); | 517 | lastlistfield(fs, &cc); |
| 518 | if (cc.na > 0) | 518 | SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ |
| 519 | SETARG_B(fs->f->code[pc], luaO_log2(cc.na-1)+2); /* set initial table size */ | ||
| 520 | SETARG_C(fs->f->code[pc], luaO_log2(cc.nh)+1); /* set initial table size */ | 519 | SETARG_C(fs->f->code[pc], luaO_log2(cc.nh)+1); /* set initial table size */ |
| 521 | } | 520 | } |
| 522 | 521 | ||
