Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
random.h
Go to the documentation of this file.
1
#ifndef RANDOM_H
2
#define RANDOM_H
3
4
#include "
dolphin/types.h
"
5
6
namespace
JMath
{
7
12
struct
TRandom_fast_
{
13
u32
value
;
14
15
TRandom_fast_
(
u32
value
);
16
u32
get
(
void
) {
17
value
= (
value
* 0x19660d) + 0x3c6ef35f;
18
return
value
;
19
}
20
21
u32
get_bit32
(
void
) {
return
this->
get
(); }
22
23
// due to the float constant, having this function inlined adds that float to data,
24
// making it not match
25
float
get_ufloat_1
(
void
) {
26
// !@bug UB: in C++ it's not legal to read from an union member other
27
// than the last one that was written to.
28
union
{
29
f32
f;
30
u32
s
;
31
} out;
32
out.s = (this->
get
() >> 9) | 0x3f800000;
33
return
out.f - 1;
34
}
35
36
void
setSeed
(
u32
seed) {
value
= seed; }
37
};
38
39
template
<
class
RandomT>
40
class
TRandom_
:
public
RandomT {
41
public
:
42
TRandom_
(
u32
value) : RandomT(value) {}
43
44
u8
get_uint8
(
u8
param_0) {
45
return
this->get_ufloat_1() * param_0;
46
}
47
};
48
49
}
// namespace JMath
50
51
#endif
/* RANDOM_H */
JMath::TRandom_
Definition
random.h:40
JMath::TRandom_::TRandom_
TRandom_(u32 value)
Definition
random.h:42
JMath::TRandom_::get_uint8
u8 get_uint8(u8 param_0)
Definition
random.h:44
types.h
u32
unsigned long u32
Definition
types.h:12
f32
float f32
Definition
types.h:25
u8
unsigned char u8
Definition
types.h:8
s
s
Definition
e_acos.c:94
JMath
Definition
JMATrigonometric.cpp:71
JMath::TRandom_fast_
Definition
random.h:12
JMath::TRandom_fast_::get
u32 get(void)
Definition
random.h:16
JMath::TRandom_fast_::get_ufloat_1
float get_ufloat_1(void)
Definition
random.h:25
JMath::TRandom_fast_::TRandom_fast_
TRandom_fast_(u32 value)
Definition
random.cpp:5
JMath::TRandom_fast_::setSeed
void setSeed(u32 seed)
Definition
random.h:36
JMath::TRandom_fast_::get_bit32
u32 get_bit32(void)
Definition
random.h:21
JMath::TRandom_fast_::value
u32 value
Definition
random.h:13
include
JSystem
JMath
random.h
Generated by
1.12.0