MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaO_ceillog2

Function luaO_ceillog2

freebsd/contrib/openzfs/module/lua/lobject.c:51–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51int luaO_ceillog2 (unsigned int x) {
52 static const lu_byte log_2[256] = {
53 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,
54 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,
55 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,
56 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,
57 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,
58 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,
59 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,
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 };
62 int l = 0;
63 x--;
64 while (x >= 256) { l += 8; x >>= 8; }
65 return l + log_2[x];
66}
67
68
69lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2) {

Callers 2

countintFunction · 0.85
setnodevectorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected