16 #if !defined(LUA_NBITS)
21 #define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1))
24 #define trim(x) ((x) & ALLONES)
28 #define mask(n) (~((ALLONES << 1) << ((n) - 1)))
38 for (i = 1; i <=
n; i++)
61 for (i = 1; i <=
n; i++)
71 for (i = 1; i <=
n; i++)
160 luaL_error(L,
"trying to access non-existent bits");
170 r = (r >>
f) &
mask(w);
183 r = (r & ~(m <<
f)) | (v <<
f);
static int b_lshift(lua_State *L)
static int b_not(lua_State *L)
LUA_API void lua_pushboolean(lua_State *L, int b)
LUA_API void lua_pushunsigned(lua_State *L, lua_Unsigned u)
static int b_and(lua_State *L)
LUA_API int lua_gettop(lua_State *L)
static int b_rrot(lua_State *L)
static int fieldargs(lua_State *L, int farg, int *width)
#define luaL_argcheck(L, cond, numarg, extramsg)
static int b_test(lua_State *L)
GLubyte GLubyte GLubyte GLubyte w
static b_uint andaux(lua_State *L)
static int b_xor(lua_State *L)
static int b_arshift(lua_State *L)
static int b_shift(lua_State *L, b_uint r, int i)
static int b_or(lua_State *L)
LUALIB_API lua_Unsigned luaL_checkunsigned(lua_State *L, int narg)
GLdouble GLdouble GLdouble r
#define luaL_newlib(L, l)
LUA_UNSIGNED lua_Unsigned
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
static const luaL_Reg bitlib[]
#define luaL_checkint(L, n)
#define luaL_optint(L, n, d)
static int b_replace(lua_State *L)
LUAMOD_API int luaopen_bit32(lua_State *L)
GLint GLint GLint GLint GLint GLint GLsizei width
static int b_rot(lua_State *L, int i)
static int b_lrot(lua_State *L)
static int b_rshift(lua_State *L)
static int b_extract(lua_State *L)