mirror of
https://github.com/lua/lua.git
synced 2025-01-28 06:03:00 +08:00
details
This commit is contained in:
parent
653977a0ac
commit
f856fdeabd
@ -35,14 +35,14 @@ int luaO_log2 (unsigned int x) {
|
|||||||
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,
|
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,
|
||||||
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,
|
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,
|
||||||
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,
|
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,
|
||||||
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,
|
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
|
||||||
};
|
};
|
||||||
if (x & 0xffff0000) {
|
if (x >= 0x00010000) {
|
||||||
if (x & 0xff000000) return log_8[((x>>24) & 0xff) - 1]+24;
|
if (x >= 0x01000000) return log_8[((x>>24) & 0xff) - 1]+24;
|
||||||
else return log_8[((x>>16) & 0xff) - 1]+16;
|
else return log_8[((x>>16) & 0xff) - 1]+16;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (x & 0x0000ff00) return log_8[((x>>8) & 0xff) - 1]+8;
|
if (x >= 0x00000100) return log_8[((x>>8) & 0xff) - 1]+8;
|
||||||
else if (x) return log_8[(x & 0xff) - 1];
|
else if (x) return log_8[(x & 0xff) - 1];
|
||||||
return -1; /* special `log' for 0 */
|
return -1; /* special `log' for 0 */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user