From aedcfb94144b173a5af52c05c590e9af12b6632b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 14 Jun 2018 15:47:22 -0300 Subject: type 'Rand64' may not be long long, so it should not use 'LL' in its constants --- lmathlib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lmathlib.c b/lmathlib.c index ecbf4dd1..41012797 100644 --- a/lmathlib.c +++ b/lmathlib.c @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.133 2018/05/09 14:54:37 roberto Exp roberto $ +** $Id: lmathlib.c,v 1.134 2018/05/16 11:27:59 roberto Exp roberto $ ** Standard mathematical library ** See Copyright Notice in lua.h */ @@ -279,7 +279,7 @@ static int math_type (lua_State *L) { #elif (LUA_MAXINTEGER >> 31 >> 31) >= 1 /* 'lua_Integer' has at least 64 bits */ -#define Rand64 LUA_UNSIGNED +#define Rand64 lua_Unsigned #endif @@ -325,8 +325,9 @@ static Rand64 nextrand (Rand64 *state) { ** Convert bits from a random integer into a float in the ** interval [0,1). */ -#define maskFIG (~(~1LLU << (FIGS - 1))) /* use FIGS bits */ -#define shiftFIG (l_mathop(0.5) / (1LLU << (FIGS - 1))) /* 2^(-FIGS) */ +#define maskFIG (~(~(Rand64)1 << (FIGS - 1))) /* use FIGS bits */ +#define shiftFIG \ + (l_mathop(0.5) / ((Rand64)1 << (FIGS - 1))) /* 2^(-FIGS) */ static lua_Number I2d (Rand64 x) { return (lua_Number)(x & maskFIG) * shiftFIG; -- cgit v1.2.3-55-g6feb