diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2016-12-20 07:50:49 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2016-12-20 07:50:49 +0000 |
| commit | bea5d09b1f10fcf5501cefd93c1ff40bfc98f12b (patch) | |
| tree | ed964320fc996e4a42ac14fd762f2c7a7d90b299 /lib/libc | |
| parent | e8238c2940cfdafd97daa8a18529ecabb0a77fcb (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/jrand48.c | 5 | ||||
| -rw-r--r-- | lib/libc/gen/mrand48.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/gen/jrand48.c b/lib/libc/gen/jrand48.c index 17076205559a2..5aab1e1bec9ef 100644 --- a/lib/libc/gen/jrand48.c +++ b/lib/libc/gen/jrand48.c @@ -14,11 +14,14 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <stdint.h> + #include "rand48.h" long jrand48(unsigned short xseed[3]) { + _dorand48(xseed); - return ((long) xseed[2] << 16) + (long) xseed[1]; + return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1])); } diff --git a/lib/libc/gen/mrand48.c b/lib/libc/gen/mrand48.c index ef20fb87bf507..795a8585802d9 100644 --- a/lib/libc/gen/mrand48.c +++ b/lib/libc/gen/mrand48.c @@ -14,6 +14,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <stdint.h> + #include "rand48.h" extern unsigned short _rand48_seed[3]; @@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3]; long mrand48(void) { + _dorand48(_rand48_seed); - return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1]; + return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) | + (uint32_t)_rand48_seed[1])); } |
