From f9db9eca40fdc78fae258b8e12eb689fc2d5e0e5 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 7 Sep 2018 23:02:40 -0400 Subject: [PATCH] add and use internal header for *rand48 lcg --- src/prng/__rand48_step.c | 1 + src/prng/__seed48.c | 2 ++ src/prng/drand48.c | 4 +--- src/prng/lcong48.c | 3 +-- src/prng/lrand48.c | 4 +--- src/prng/mrand48.c | 4 +--- src/prng/rand48.h | 4 ++++ src/prng/seed48.c | 3 +-- 8 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 src/prng/rand48.h diff --git a/src/prng/__rand48_step.c b/src/prng/__rand48_step.c index 961d30fc..94703d07 100644 --- a/src/prng/__rand48_step.c +++ b/src/prng/__rand48_step.c @@ -1,4 +1,5 @@ #include +#include "rand48.h" uint64_t __rand48_step(unsigned short *xi, unsigned short *lc) { diff --git a/src/prng/__seed48.c b/src/prng/__seed48.c index 05a4539e..e436b4d3 100644 --- a/src/prng/__seed48.c +++ b/src/prng/__seed48.c @@ -1 +1,3 @@ +#include "rand48.h" + unsigned short __seed48[7] = { 0, 0, 0, 0xe66d, 0xdeec, 0x5, 0xb }; diff --git a/src/prng/drand48.c b/src/prng/drand48.c index d808353c..08283e24 100644 --- a/src/prng/drand48.c +++ b/src/prng/drand48.c @@ -1,8 +1,6 @@ #include #include - -uint64_t __rand48_step(unsigned short *xi, unsigned short *lc); -extern unsigned short __seed48[7]; +#include "rand48.h" double erand48(unsigned short s[3]) { diff --git a/src/prng/lcong48.c b/src/prng/lcong48.c index 32b27d42..030e5148 100644 --- a/src/prng/lcong48.c +++ b/src/prng/lcong48.c @@ -1,7 +1,6 @@ #include #include - -extern unsigned short __seed48[7]; +#include "rand48.h" void lcong48(unsigned short p[7]) { diff --git a/src/prng/lrand48.c b/src/prng/lrand48.c index a3c4e4e2..07e2b784 100644 --- a/src/prng/lrand48.c +++ b/src/prng/lrand48.c @@ -1,8 +1,6 @@ #include #include - -uint64_t __rand48_step(unsigned short *xi, unsigned short *lc); -extern unsigned short __seed48[7]; +#include "rand48.h" long nrand48(unsigned short s[3]) { diff --git a/src/prng/mrand48.c b/src/prng/mrand48.c index 0519d667..f4a56e61 100644 --- a/src/prng/mrand48.c +++ b/src/prng/mrand48.c @@ -1,8 +1,6 @@ #include #include - -uint64_t __rand48_step(unsigned short *xi, unsigned short *lc); -extern unsigned short __seed48[7]; +#include "rand48.h" long jrand48(unsigned short s[3]) { diff --git a/src/prng/rand48.h b/src/prng/rand48.h new file mode 100644 index 00000000..4ed6ae52 --- /dev/null +++ b/src/prng/rand48.h @@ -0,0 +1,4 @@ +#include + +uint64_t __rand48_step(unsigned short *xi, unsigned short *lc); +extern unsigned short __seed48[7]; diff --git a/src/prng/seed48.c b/src/prng/seed48.c index e0699c09..bce7b339 100644 --- a/src/prng/seed48.c +++ b/src/prng/seed48.c @@ -1,7 +1,6 @@ #include #include - -extern unsigned short __seed48[7]; +#include "rand48.h" unsigned short *seed48(unsigned short *s) { -- 2.25.1