summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-01-09 12:11:05 -0200
committerRenato Botelho <renato@netgate.com>2017-01-09 12:11:05 -0200
commit681a482d8fc4bfc14a24f7a9d75cca6337f2a520 (patch)
tree08368e0c4dcea4baa16f4a34b2cc104c42e1ed27 /lib/libc/gen
parentcbeab2a9b6b7ac70992175202f35fcc05a5821d5 (diff)
parent91f6edbb8913d163d5c16fb615e84baf8a16d390 (diff)
downloadFreeBSD-src-681a482d8fc4bfc14a24f7a9d75cca6337f2a520.zip
FreeBSD-src-681a482d8fc4bfc14a24f7a9d75cca6337f2a520.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/jrand48.c5
-rw-r--r--lib/libc/gen/mrand48.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/gen/jrand48.c b/lib/libc/gen/jrand48.c
index 1707620..5aab1e1 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 ef20fb87b..795a858 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]));
}
OpenPOWER on IntegriCloud