MCPcopy Create free account
hub / github.com/defold/defold / luaO_int2fb

Function luaO_int2fb

engine/lua/src/lua/lobject.c:35–43  ·  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

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

Callers 1

constructorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected