MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / b_arshift

Function b_arshift

src/Chain/libraries/glua/lbitlib.cpp:125–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123
124
125static int b_arshift(lua_State *L) {
126 lua_Unsigned r = checkunsigned(L, 1);
127 lua_Integer i = luaL_checkinteger(L, 2);
128 if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1))))
129 return b_shift(L, r, -i);
130 else { /* arithmetic shift for 'negative' number */
131 if (i >= LUA_NBITS) r = ALLONES;
132 else
133 r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */
134 pushunsigned(L, r);
135 return 1;
136 }
137}
138
139
140static int b_rot(lua_State *L, lua_Integer d) {

Callers

nothing calls this directly

Calls 2

b_shiftFunction · 0.85
trimFunction · 0.50

Tested by

no test coverage detected