conventional names for bitwise operators

This commit is contained in:
Roberto Ierusalimschy
2010-11-22 14:39:20 -02:00
parent a2eaad5d81
commit 092fa71ddd

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lbitlib.c,v 1.10 2010/10/28 15:17:29 roberto Exp roberto $ ** $Id: lbitlib.c,v 1.11 2010/11/08 16:31:22 roberto Exp roberto $
** Standard library for bitwise operations ** Standard library for bitwise operations
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -130,27 +130,27 @@ static int b_rot (lua_State *L, int i) {
} }
static int b_rol (lua_State *L) { static int b_lrot (lua_State *L) {
return b_rot(L, luaL_checkint(L, 2)); return b_rot(L, luaL_checkint(L, 2));
} }
static int b_ror (lua_State *L) { static int b_rrot (lua_State *L) {
return b_rot(L, -luaL_checkint(L, 2)); return b_rot(L, -luaL_checkint(L, 2));
} }
static const luaL_Reg bitlib[] = { static const luaL_Reg bitlib[] = {
{"AND", b_and}, {"arshift", b_arshift},
{"TEST", b_test}, {"band", b_and},
{"OR", b_or}, {"bnot", b_not},
{"XOR", b_xor}, {"bor", b_or},
{"NOT", b_not}, {"bxor", b_xor},
{"SHL", b_lshift}, {"lrotate", b_lrot},
{"SAR", b_arshift}, {"lshift", b_lshift},
{"SHR", b_rshift}, {"rrotate", b_rrot},
{"ROL", b_rol}, {"rshift", b_rshift},
{"ROR", b_ror}, {"test", b_test},
{NULL, NULL} {NULL, NULL}
}; };