diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-04-10 09:18:17 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-04-10 09:18:17 -0300 |
| commit | 94d40f3980d4f13ed33d1c23fcc8c7aafbd7be59 (patch) | |
| tree | fc38e115dc56be07d1fe2edfc4b6fc35b9d9847b /lobject.c | |
| parent | 585b81f91eeff445f77de7276b23c8b8df22e8c5 (diff) | |
| download | lua-94d40f3980d4f13ed33d1c23fcc8c7aafbd7be59.tar.gz lua-94d40f3980d4f13ed33d1c23fcc8c7aafbd7be59.tar.bz2 lua-94d40f3980d4f13ed33d1c23fcc8c7aafbd7be59.zip | |
luaO_log2 can be private to ltable.c
Diffstat (limited to 'lobject.c')
| -rw-r--r-- | lobject.c | 20 |
1 files changed, 1 insertions, 19 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 2.23 2006/07/11 15:53:29 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.24 2006/11/22 11:02:03 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -51,24 +51,6 @@ int luaO_fb2int (int x) { | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | 53 | ||
| 54 | int luaO_log2 (unsigned int x) { | ||
| 55 | static const lu_byte log_2[256] = { | ||
| 56 | 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | ||
| 57 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | ||
| 58 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
| 59 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
| 60 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | ||
| 61 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | ||
| 62 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, | ||
| 63 | 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 | ||
| 64 | }; | ||
| 65 | int l = -1; | ||
| 66 | while (x >= 256) { l += 8; x >>= 8; } | ||
| 67 | return l + log_2[x]; | ||
| 68 | |||
| 69 | } | ||
| 70 | |||
| 71 | |||
| 72 | int luaO_rawequalObj (const TValue *t1, const TValue *t2) { | 54 | int luaO_rawequalObj (const TValue *t1, const TValue *t2) { |
| 73 | if (ttype(t1) != ttype(t2)) return 0; | 55 | if (ttype(t1) != ttype(t2)) return 0; |
| 74 | else switch (ttype(t1)) { | 56 | else switch (ttype(t1)) { |
