diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-12-16 23:19:27 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-12-16 23:23:10 -0500 |
commit | adfe682eb0d77c6afc751f5e407d9da39623c24e (patch) | |
tree | b528ab022c560465693517567d58c5786e7fdd96 | |
parent | bfcf5735d08b4e57e0865006392822f8b526771a (diff) | |
download | musl-adfe682eb0d77c6afc751f5e407d9da39623c24e.tar.gz musl-adfe682eb0d77c6afc751f5e407d9da39623c24e.tar.xz musl-adfe682eb0d77c6afc751f5e407d9da39623c24e.zip |
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.
-rw-r--r-- | src/prng/mrand48.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) |