diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-12 16:13:50 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-12 16:13:50 -0300 |
| commit | 1fb4d539254b67e7e35ed698250c66d1edff0e08 (patch) | |
| tree | 8f48b7ca736a7fb02834bcfac1415cd43307f529 /lobject.c | |
| parent | f6aab3ec1f111cd8d968bdcb7ca800e93b819d24 (diff) | |
| download | lua-1fb4d539254b67e7e35ed698250c66d1edff0e08.tar.gz lua-1fb4d539254b67e7e35ed698250c66d1edff0e08.tar.bz2 lua-1fb4d539254b67e7e35ed698250c66d1edff0e08.zip | |
OP_NEWTABLE keeps exact size of arrays
OP_NEWTABLE is followed by an OP_EXTRAARG, so that it can keep
the exact size of the array part of the table to be created.
(Functions 'luaO_int2fb'/'luaO_fb2int' were removed.)
Diffstat (limited to 'lobject.c')
| -rw-r--r-- | lobject.c | 26 |
1 files changed, 0 insertions, 26 deletions
| @@ -30,32 +30,6 @@ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| 33 | ** converts an integer to a "floating point byte", represented as | ||
| 34 | ** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if | ||
| 35 | ** eeeee != 0 and (xxx) otherwise. | ||
| 36 | */ | ||
| 37 | int luaO_int2fb (unsigned int x) { | ||
| 38 | int e = 0; /* exponent */ | ||
| 39 | if (x < 8) return x; | ||
| 40 | while (x >= (8 << 4)) { /* coarse steps */ | ||
| 41 | x = (x + 0xf) >> 4; /* x = ceil(x / 16) */ | ||
| 42 | e += 4; | ||
| 43 | } | ||
| 44 | while (x >= (8 << 1)) { /* fine steps */ | ||
| 45 | x = (x + 1) >> 1; /* x = ceil(x / 2) */ | ||
| 46 | e++; | ||
| 47 | } | ||
| 48 | return ((e+1) << 3) | (cast_int(x) - 8); | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 52 | /* converts back */ | ||
| 53 | int luaO_fb2int (int x) { | ||
| 54 | return (x < 8) ? x : ((x & 7) + 8) << ((x >> 3) - 1); | ||
| 55 | } | ||
| 56 | |||
| 57 | |||
| 58 | /* | ||
| 59 | ** Computes ceil(log2(x)) | 33 | ** Computes ceil(log2(x)) |
| 60 | */ | 34 | */ |
| 61 | int luaO_ceillog2 (unsigned int x) { | 35 | int luaO_ceillog2 (unsigned int x) { |
