OpenBarnyard
 
Loading...
Searching...
No Matches
TRandom.cpp File Reference
#include "ToshiPCH.h"
#include "TRandom.h"

Go to the source code of this file.

Namespaces

namespace  Toshi
 

Macros

#define cut(a)
 
#define ind(mm, x)
 
#define rngstep(mix, a, b, mm, m, m2, r, x)
 
#define mix(a, b, c, d, e, f, g, h)
 
#define shuffle(a, b, mm, m, m2, r, x)
 

Macro Definition Documentation

◆ cut

#define cut ( a)
Value:
( a ) /* A no-op */

Definition at line 7 of file TRandom.cpp.

◆ ind

#define ind ( mm,
x )
Value:
( ( mm )[ ( x >> 2 ) & ( RANDSIZ - 1 ) ] )
#define RANDSIZ
Definition TRandom.h:15

Definition at line 10 of file TRandom.cpp.

◆ mix

#define mix ( a,
b,
c,
d,
e,
f,
g,
h )
Value:
{ \
a ^= b << 11; \
d += a; \
b += c; \
b ^= c >> 2; \
e += b; \
c += d; \
c ^= d << 8; \
f += c; \
d += e; \
d ^= e >> 16; \
g += d; \
e += f; \
e ^= f << 10; \
h += e; \
f += g; \
f ^= g >> 4; \
a += f; \
g += h; \
g ^= h << 8; \
b += g; \
h += a; \
h ^= a >> 9; \
c += h; \
a += b; \
}

Definition at line 20 of file TRandom.cpp.

20#define mix( a, b, c, d, e, f, g, h ) \
21 { \
22 a ^= b << 11; \
23 d += a; \
24 b += c; \
25 b ^= c >> 2; \
26 e += b; \
27 c += d; \
28 c ^= d << 8; \
29 f += c; \
30 d += e; \
31 d ^= e >> 16; \
32 g += d; \
33 e += f; \
34 e ^= f << 10; \
35 h += e; \
36 f += g; \
37 f ^= g >> 4; \
38 a += f; \
39 g += h; \
40 g ^= h << 8; \
41 b += g; \
42 h += a; \
43 h ^= a >> 9; \
44 c += h; \
45 a += b; \
46 }

◆ rngstep

#define rngstep ( mix,
a,
b,
mm,
m,
m2,
r,
x )
Value:
{ \
x = *m; \
a = cut( ( a ^ ( mix ) ) + *( m2++ ) ); \
*( m++ ) = y = cut( ind( mm, x ) + a + b ); \
*( r++ ) = b = cut( ind( mm, y >> RANDSIZL ) + x ); \
}
#define ind(mm, x)
Definition TRandom.cpp:10
#define cut(a)
Definition TRandom.cpp:7
#define mix(a, b, c, d, e, f, g, h)
Definition TRandom.cpp:20
#define RANDSIZL
Definition TRandom.h:14

Definition at line 12 of file TRandom.cpp.

12#define rngstep( mix, a, b, mm, m, m2, r, x ) \
13 { \
14 x = *m; \
15 a = cut( ( a ^ ( mix ) ) + *( m2++ ) ); \
16 *( m++ ) = y = cut( ind( mm, x ) + a + b ); \
17 *( r++ ) = b = cut( ind( mm, y >> RANDSIZL ) + x ); \
18 }

◆ shuffle

#define shuffle ( a,
b,
mm,
m,
m2,
r,
x )
Value:
{ \
rngstep( a << 13, a, b, mm, m, m2, r, x ); \
rngstep( a >> 6, a, b, mm, m, m2, r, x ); \
rngstep( a << 2, a, b, mm, m, m2, r, x ); \
rngstep( a >> 16, a, b, mm, m, m2, r, x ); \
}

Definition at line 48 of file TRandom.cpp.

48#define shuffle( a, b, mm, m, m2, r, x ) \
49 { \
50 rngstep( a << 13, a, b, mm, m, m2, r, x ); \
51 rngstep( a >> 6, a, b, mm, m, m2, r, x ); \
52 rngstep( a << 2, a, b, mm, m, m2, r, x ); \
53 rngstep( a >> 16, a, b, mm, m, m2, r, x ); \
54 }