From 347d6961ac14213264c7176e3d125c9ba8475b01 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 14 May 2019 11:10:24 -0300 Subject: Define LUA_MAXUNSIGNED as a preprocessor constant The previous definition of LUA_MAXUNSIGNED used a typecast, making it unsuitable for constant expressions in the preprocessor. --- luaconf.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'luaconf.h') diff --git a/luaconf.h b/luaconf.h index e6271b80..66dca6bf 100644 --- a/luaconf.h +++ b/luaconf.h @@ -515,7 +515,6 @@ */ #define LUA_UNSIGNED unsigned LUAI_UACINT -#define LUA_MAXUNSIGNED (~(lua_Unsigned)0) #define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT) @@ -530,6 +529,8 @@ #define LUA_MAXINTEGER INT_MAX #define LUA_MININTEGER INT_MIN +#define LUA_MAXUNSIGNED UINT_MAX + #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ #define LUA_INTEGER long @@ -538,6 +539,8 @@ #define LUA_MAXINTEGER LONG_MAX #define LUA_MININTEGER LONG_MIN +#define LUA_MAXUNSIGNED ULONG_MAX + #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ /* use presence of macro LLONG_MAX as proxy for C99 compliance */ @@ -550,6 +553,8 @@ #define LUA_MAXINTEGER LLONG_MAX #define LUA_MININTEGER LLONG_MIN +#define LUA_MAXUNSIGNED ULLONG_MAX + #elif defined(LUA_USE_WINDOWS) /* }{ */ /* in Windows, can use specific Windows types */ @@ -559,6 +564,8 @@ #define LUA_MAXINTEGER _I64_MAX #define LUA_MININTEGER _I64_MIN +#define LUA_MAXUNSIGNED _UI64_MAX + #else /* }{ */ #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ -- cgit v1.2.3-55-g6feb