USHRT_MAX changed to SHRT_MAX

USHRT_MAX does not fit in an 'int' in 16-bit systems.
This commit is contained in:
Roberto Ierusalimschy
2024-09-19 19:06:16 -03:00
parent ddfa1fbccf
commit 9b72355f99
2 changed files with 2 additions and 2 deletions

2
lapi.c
View File

@@ -1340,7 +1340,7 @@ void lua_warning (lua_State *L, const char *msg, int tocont) {
LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) {
Udata *u;
lua_lock(L);
api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value");
api_check(L, 0 <= nuvalue && nuvalue < SHRT_MAX, "invalid value");
u = luaS_newudata(L, size, cast(unsigned short, nuvalue));
setuvalue(L, s2v(L->top.p), u);
api_incr_top(L);