Browse Source

add and use internal header for *rand48 lcg

Rich Felker 6 năm trước cách đây
mục cha
commit
f9db9eca40

+ 1 - 0
src/prng/__rand48_step.c

@@ -1,4 +1,5 @@
 #include <stdint.h>
+#include "rand48.h"
 
 uint64_t __rand48_step(unsigned short *xi, unsigned short *lc)
 {

+ 2 - 0
src/prng/__seed48.c

@@ -1 +1,3 @@
+#include "rand48.h"
+
 unsigned short __seed48[7] = { 0, 0, 0, 0xe66d, 0xdeec, 0x5, 0xb };

+ 1 - 3
src/prng/drand48.c

@@ -1,8 +1,6 @@
 #include <stdlib.h>
 #include <inttypes.h>
-
-uint64_t __rand48_step(unsigned short *xi, unsigned short *lc);
-extern unsigned short __seed48[7];
+#include "rand48.h"
 
 double erand48(unsigned short s[3])
 {

+ 1 - 2
src/prng/lcong48.c

@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
-
-extern unsigned short __seed48[7];
+#include "rand48.h"
 
 void lcong48(unsigned short p[7])
 {

+ 1 - 3
src/prng/lrand48.c

@@ -1,8 +1,6 @@
 #include <stdlib.h>
 #include <inttypes.h>
-
-uint64_t __rand48_step(unsigned short *xi, unsigned short *lc);
-extern unsigned short __seed48[7];
+#include "rand48.h"
 
 long nrand48(unsigned short s[3])
 {

+ 1 - 3
src/prng/mrand48.c

@@ -1,8 +1,6 @@
 #include <stdlib.h>
 #include <inttypes.h>
-
-uint64_t __rand48_step(unsigned short *xi, unsigned short *lc);
-extern unsigned short __seed48[7];
+#include "rand48.h"
 
 long jrand48(unsigned short s[3])
 {

+ 4 - 0
src/prng/rand48.h

@@ -0,0 +1,4 @@
+#include <stdint.h>
+
+uint64_t __rand48_step(unsigned short *xi, unsigned short *lc);
+extern unsigned short __seed48[7];

+ 1 - 2
src/prng/seed48.c

@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
-
-extern unsigned short __seed48[7];
+#include "rand48.h"
 
 unsigned short *seed48(unsigned short *s)
 {