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

Function luaopen_bit

app/redis-6.2.6/deps/lua/src/lua_bit.c:164–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162#define BAD_SAR (bsar(-8, 2) != (SBits)-2)
163
164LUALIB_API int luaopen_bit(lua_State *L)
165{
166 UBits b;
167 lua_pushnumber(L, (lua_Number)1437217655L);
168 b = barg(L, -1);
169 if (b != (UBits)1437217655L || BAD_SAR) { /* Perform a simple self-test. */
170 const char *msg = "compiled with incompatible luaconf.h";
171#ifdef LUA_NUMBER_DOUBLE
172#ifdef _WIN32
173 if (b == (UBits)1610612736L)
174 msg = "use D3DCREATE_FPU_PRESERVE with DirectX";
175#endif
176 if (b == (UBits)1127743488L)
177 msg = "not compiled with SWAPPED_DOUBLE";
178#endif
179 if (BAD_SAR)
180 msg = "arithmetic right-shift broken";
181 luaL_error(L, "bit library self-test failed (%s)", msg);
182 }
183#if LUA_VERSION_NUM < 502
184 luaL_register(L, "bit", bit_funcs);
185#else
186 luaL_newlib(L, bit_funcs);
187#endif
188 return 1;
189}
190

Callers

nothing calls this directly

Calls 3

bargFunction · 0.85
lua_pushnumberFunction · 0.70
luaL_errorFunction · 0.70

Tested by

no test coverage detected