| 138 | |
| 139 | |
| 140 | static int b_rot(lua_State *L, lua_Integer d) { |
| 141 | lua_Unsigned r = checkunsigned(L, 1); |
| 142 | int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ |
| 143 | r = trim(r); |
| 144 | if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ |
| 145 | r = (r << i) | (r >> (LUA_NBITS - i)); |
| 146 | pushunsigned(L, trim(r)); |
| 147 | return 1; |
| 148 | } |
| 149 | |
| 150 | |
| 151 | static int b_lrot(lua_State *L) { |