| 111 | |
| 112 | |
| 113 | static 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 | |
| 128 | static int b_rot (lua_State *L, int i) { |
nothing calls this directly
no test coverage detected