|
|
|
@ -50,12 +50,7 @@ int lua_new_uint32_t(lua_State *L) {
@@ -50,12 +50,7 @@ int lua_new_uint32_t(lua_State *L) {
|
|
|
|
|
|
|
|
|
|
#define UINT32_T_BOX_OP(name, sym) \ |
|
|
|
|
int uint32_t___##name(lua_State *L) { \
|
|
|
|
|
const int args = lua_gettop(L); \
|
|
|
|
|
if (args > 2) { \
|
|
|
|
|
return luaL_argerror(L, args, "too many arguments"); \
|
|
|
|
|
} else if (args < 2) { \
|
|
|
|
|
return luaL_argerror(L, args, "too few arguments"); \
|
|
|
|
|
} \
|
|
|
|
|
binding_argcheck(L, 2); \
|
|
|
|
|
\
|
|
|
|
|
uint32_t v1 = coerce_to_uint32_t(L, 1); \
|
|
|
|
|
uint32_t v2 = coerce_to_uint32_t(L, 2); \
|
|
|
|
@ -79,13 +74,7 @@ UINT32_T_BOX_OP(shr, >>)
@@ -79,13 +74,7 @@ UINT32_T_BOX_OP(shr, >>)
|
|
|
|
|
|
|
|
|
|
#define UINT32_T_BOX_OP_BOOL(name, sym) \ |
|
|
|
|
int uint32_t___##name(lua_State *L) { \
|
|
|
|
|
const int args = lua_gettop(L); \
|
|
|
|
|
luaL_checkstack(L, 1, "Out of stack"); \
|
|
|
|
|
if (args > 2) { \
|
|
|
|
|
return luaL_argerror(L, args, "too many arguments"); \
|
|
|
|
|
} else if (args < 2) { \
|
|
|
|
|
return luaL_argerror(L, args, "too few arguments"); \
|
|
|
|
|
} \
|
|
|
|
|
binding_argcheck(L, 2); \
|
|
|
|
|
\
|
|
|
|
|
uint32_t v1 = coerce_to_uint32_t(L, 1); \
|
|
|
|
|
uint32_t v2 = coerce_to_uint32_t(L, 2); \
|
|
|
|
@ -100,11 +89,7 @@ UINT32_T_BOX_OP_BOOL(le, <=)
@@ -100,11 +89,7 @@ UINT32_T_BOX_OP_BOOL(le, <=)
|
|
|
|
|
|
|
|
|
|
#define UINT32_T_BOX_OP_UNARY(name, sym) \ |
|
|
|
|
int uint32_t___##name(lua_State *L) { \
|
|
|
|
|
const int args = lua_gettop(L); \
|
|
|
|
|
luaL_checkstack(L, 1, "Out of stack"); \
|
|
|
|
|
if (args != 1) { \
|
|
|
|
|
return luaL_argerror(L, args, "Expected 1 argument"); \
|
|
|
|
|
} \
|
|
|
|
|
binding_argcheck(L, 1); \
|
|
|
|
|
\
|
|
|
|
|
uint32_t v1 = coerce_to_uint32_t(L, 1); \
|
|
|
|
|
\
|
|
|
|
@ -117,10 +102,7 @@ UINT32_T_BOX_OP_BOOL(le, <=)
@@ -117,10 +102,7 @@ UINT32_T_BOX_OP_BOOL(le, <=)
|
|
|
|
|
UINT32_T_BOX_OP_UNARY(bnot, ~) |
|
|
|
|
|
|
|
|
|
int uint32_t_toint(lua_State *L) { |
|
|
|
|
const int args = lua_gettop(L); |
|
|
|
|
if (args != 1) { |
|
|
|
|
return luaL_argerror(L, args, "Expected 1 argument"); |
|
|
|
|
} |
|
|
|
|
binding_argcheck(L, 1); |
|
|
|
|
|
|
|
|
|
uint32_t v = *static_cast<uint32_t *>(luaL_checkudata(L, 1, "uint32_t")); |
|
|
|
|
|
|
|
|
@ -130,10 +112,7 @@ int uint32_t_toint(lua_State *L) {
@@ -130,10 +112,7 @@ int uint32_t_toint(lua_State *L) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int uint32_t_tofloat(lua_State *L) { |
|
|
|
|
const int args = lua_gettop(L); |
|
|
|
|
if (args != 1) { |
|
|
|
|
return luaL_argerror(L, args, "Expected 1 argument"); |
|
|
|
|
} |
|
|
|
|
binding_argcheck(L, 1); |
|
|
|
|
|
|
|
|
|
uint32_t v = *static_cast<uint32_t *>(luaL_checkudata(L, 1, "uint32_t")); |
|
|
|
|
|
|
|
|
@ -143,10 +122,7 @@ int uint32_t_tofloat(lua_State *L) {
@@ -143,10 +122,7 @@ int uint32_t_tofloat(lua_State *L) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int uint32_t___tostring(lua_State *L) { |
|
|
|
|
const int args = lua_gettop(L); |
|
|
|
|
if (args != 1) { |
|
|
|
|
return luaL_argerror(L, args, "Expected 1 argument"); |
|
|
|
|
} |
|
|
|
|
binding_argcheck(L, 1); |
|
|
|
|
|
|
|
|
|
uint32_t v = *static_cast<uint32_t *>(luaL_checkudata(L, 1, "uint32_t")); |
|
|
|
|
|
|
|
|
|