]> git.saurik.com Git - apple/libc.git/blame - gen/FreeBSD/_rand48.c.patch
Libc-498.1.5.tar.gz
[apple/libc.git] / gen / FreeBSD / _rand48.c.patch
CommitLineData
224c7076
A
1--- _rand48.c.orig 2003-05-20 15:21:01.000000000 -0700
2+++ _rand48.c 2005-11-03 13:52:27.000000000 -0800
3@@ -16,34 +16,6 @@
4
5 #include "rand48.h"
6
7-unsigned short _rand48_seed[3] = {
8- RAND48_SEED_0,
9- RAND48_SEED_1,
10- RAND48_SEED_2
11-};
12-unsigned short _rand48_mult[3] = {
13- RAND48_MULT_0,
14- RAND48_MULT_1,
15- RAND48_MULT_2
16-};
17-unsigned short _rand48_add = RAND48_ADD;
18-
19-void
20-_dorand48(unsigned short xseed[3])
21-{
22- unsigned long accu;
23- unsigned short temp[2];
24-
25- accu = (unsigned long) _rand48_mult[0] * (unsigned long) xseed[0] +
26- (unsigned long) _rand48_add;
27- temp[0] = (unsigned short) accu; /* lower 16 bits */
28- accu >>= sizeof(unsigned short) * 8;
29- accu += (unsigned long) _rand48_mult[0] * (unsigned long) xseed[1] +
30- (unsigned long) _rand48_mult[1] * (unsigned long) xseed[0];
31- temp[1] = (unsigned short) accu; /* middle 16 bits */
32- accu >>= sizeof(unsigned short) * 8;
33- accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0];
34- xseed[0] = temp[0];
35- xseed[1] = temp[1];
36- xseed[2] = (unsigned short) accu;
37-}
38+uint48 _rand48_seed = RAND48_SEED;
39+uint48 _rand48_mult = RAND48_MULT;
40+uint48 _rand48_add = RAND48_ADD;