aboutsummaryrefslogtreecommitdiff
path: root/lmathlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-05-14 11:10:24 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-05-14 11:10:24 -0300
commit347d6961ac14213264c7176e3d125c9ba8475b01 (patch)
tree73ab74bac7bb0bed03a94b23d97acf400dde1346 /lmathlib.c
parent0b63d79b36790febd4c081bf8d6737df27529f8d (diff)
downloadlua-347d6961ac14213264c7176e3d125c9ba8475b01.tar.gz
lua-347d6961ac14213264c7176e3d125c9ba8475b01.tar.bz2
lua-347d6961ac14213264c7176e3d125c9ba8475b01.zip
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.
Diffstat (limited to 'lmathlib.c')
-rw-r--r--lmathlib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lmathlib.c b/lmathlib.c
index 3454c41f..f6f0b426 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -276,7 +276,7 @@ static int math_type (lua_State *L) {
276/* there is a 'long long' type (which must have at least 64 bits) */ 276/* there is a 'long long' type (which must have at least 64 bits) */
277#define Rand64 unsigned long long 277#define Rand64 unsigned long long
278 278
279#elif (LUA_MAXINTEGER >> 30 >> 30) >= 7 279#elif (LUA_MAXUNSIGNED >> 31 >> 31) >= 3
280 280
281/* 'lua_Integer' has at least 64 bits */ 281/* 'lua_Integer' has at least 64 bits */
282#define Rand64 lua_Unsigned 282#define Rand64 lua_Unsigned
@@ -538,7 +538,7 @@ static lua_Unsigned project (lua_Unsigned ran, lua_Unsigned n,
538 lim |= (lim >> 4); 538 lim |= (lim >> 4);
539 lim |= (lim >> 8); 539 lim |= (lim >> 8);
540 lim |= (lim >> 16); 540 lim |= (lim >> 16);
541#if (LUA_MAXINTEGER >> 30) >= 3 541#if (LUA_MAXUNSIGNED >> 31) >= 3
542 lim |= (lim >> 32); /* integer type has more than 32 bits */ 542 lim |= (lim >> 32); /* integer type has more than 32 bits */
543#endif 543#endif
544 } 544 }