MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / b_arshift

Function b_arshift

third-party/lua-5.2.4/src/lbitlib.c:113–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111
112
113static int b_arshift (lua_State *L) {
114 b_uint r = luaL_checkunsigned(L, 1);
115 int i = luaL_checkint(L, 2);
116 if (i < 0 || !(r & ((b_uint)1 << (LUA_NBITS - 1))))
117 return b_shift(L, r, -i);
118 else { /* arithmetic shift for 'negative' number */
119 if (i >= LUA_NBITS) r = ALLONES;
120 else
121 r = trim((r >> i) | ~(~(b_uint)0 >> i)); /* add signal bit */
122 lua_pushunsigned(L, r);
123 return 1;
124 }
125}
126
127
128static int b_rot (lua_State *L, int i) {

Callers

nothing calls this directly

Calls 3

luaL_checkunsignedFunction · 0.85
lua_pushunsignedFunction · 0.85
b_shiftFunction · 0.70

Tested by

no test coverage detected