projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bfcf573
)
fix mrand48/jrand48 return value on 64-bit archs
author
Rich Felker
<dalias@aerifal.cx>
Sat, 17 Dec 2016 04:19:27 +0000
(23:19 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 17 Dec 2016 04:23:10 +0000
(23:23 -0500)
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.
src/prng/mrand48.c
patch
|
blob
|
history
diff --git
a/src/prng/mrand48.c
b/src/prng/mrand48.c
index ee650fc3e6a9f25d765e99a4427281819cda96b9..0519d6676de261d9411bb87ca3eca1215ec8b9cc 100644
(file)
--- 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)