MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaO_int2fb

Function luaO_int2fb

lua/lobject.c:37–45  ·  view source on GitHub ↗

** converts an integer to a "floating point byte", represented as ** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if ** eeeee != 0 and (xxx) otherwise. */

Source from the content-addressed store, hash-verified

35** eeeee != 0 and (xxx) otherwise.
36*/
37int luaO_int2fb (unsigned int x) {
38 int e = 0; /* expoent */
39 while (x >= 16) {
40 x = (x+1) >> 1;
41 e++;
42 }
43 if (x < 8) return x;
44 else return ((e+1) << 3) | (cast_int(x) - 8);
45}
46
47
48/* converts back */

Callers 1

constructorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected