diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-02-12 00:22:29 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-02-12 00:22:29 -0500 |
commit | 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 (patch) | |
tree | 6eaef0d8a720fa3da580de87b647fff796fe80b3 /src/prng/__rand48_step.c | |
download | musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.gz musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.xz musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.zip |
initial check-in, version 0.5.0 v0.5.0
Diffstat (limited to 'src/prng/__rand48_step.c')
-rw-r--r-- | src/prng/__rand48_step.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/prng/__rand48_step.c b/src/prng/__rand48_step.c new file mode 100644 index 00000000..755b4f2f --- /dev/null +++ b/src/prng/__rand48_step.c @@ -0,0 +1,14 @@ +#include <stdlib.h> +#include <inttypes.h> + +uint64_t __rand48_step(unsigned short *xi, unsigned short *lc) +{ + uint64_t a, x; + x = xi[0] | xi[1]<<16 | xi[2]+0ULL<<32; + a = lc[0] | lc[1]<<16 | lc[2]+0ULL<<32; + x = a*x + lc[3]; + xi[0] = x; + xi[1] = x>>16; + xi[2] = x>>32; + return x & 0xffffffffffffull; +} |