MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / I2d

Function I2d

3rd/lua-5.4.3/src/lmathlib.c:337–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335#define scaleFIG (l_mathop(0.5) / ((Rand64)1 << (FIGS - 1)))
336
337static lua_Number I2d (Rand64 x) {
338 return (lua_Number)(trim64(x) >> shift64_FIG) * scaleFIG;
339}
340
341/* convert a 'Rand64' to a 'lua_Unsigned' */
342#define I2UInt(x) ((lua_Unsigned)trim64(x))

Callers 1

math_randomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected