From: Rich Felker Date: Sat, 17 Dec 2016 04:19:27 +0000 (-0500) Subject: fix mrand48/jrand48 return value on 64-bit archs X-Git-Tag: v1.1.16~11 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=adfe682eb0d77c6afc751f5e407d9da39623c24e;p=oweals%2Fmusl.git fix mrand48/jrand48 return value on 64-bit archs POSIX specifies the result to have signed 32-bit range. on 32-bit archs, the implicit conversion to long achieved the desired range already, but when long is 64-bit, a cast is needed. patch by Ed Schouten. --- diff --git a/src/prng/mrand48.c b/src/prng/mrand48.c index ee650fc3..0519d667 100644 --- a/src/prng/mrand48.c +++ b/src/prng/mrand48.c @@ -6,7 +6,7 @@ extern unsigned short __seed48[7]; long jrand48(unsigned short s[3]) { - return __rand48_step(s, __seed48+3) >> 16; + return (int32_t)(__rand48_step(s, __seed48+3) >> 16); } long mrand48(void)