The Socrates Gameboy Advance Development Engine
The SGADE is a development library for the Nintendo Gameboy
Advance. It's free for all uses and is distributed without guarantees.
For more information visit
the SGADE page.
#include "SoMath.h"Defines | |
| #define | SO_RAND_STATE_VECTOR_LENGTH |
| Internal use only. Used by the Mersenne Twister. Length of random state vector. | |
| #define | SO_RAND_PERIOD |
| Internal use only. Used by the Mersenne Twister. A period parameter. | |
| #define | SO_RAND_MAGIC |
| Internal use only. Used by the Mersenne Twister. A magic constant. | |
| #define | SO_RAND_HI_BIT(u) |
| Mask all but highest bit of u. | |
| #define | SO_RAND_LO_BIT(u) |
| Mask all but lowest bit of u. | |
| #define | SO_RAND_LO_BITS(u) |
| Mask the highest bit of u. | |
| #define | SO_RAND_MIX_BITS(u, v) |
| Move hi bit of u to hi bit of v. | |
Functions | |
| u32 | SoMathRandReloadMersenneTwister (void) |
| For internal use only. | |
| sofixedpoint | SoMathFixedMultiply (sofixedpoint a_A, sofixedpoint a_B) |
| Fixed-point multiplication function. | |
| sofixedpoint | SoMathFixedMultiplyByFraction (sofixedpoint a_A, sofixedpoint a_B) |
| Fixed-point multiplication by fraction function. | |
| sofixedpoint | SoMathFixedSqrt (sofixedpoint a_FixedValue) |
| Squareroot function. | |
| u32 | SoMathRand (void) |
| Returns a pseudo random number. | |
| void | SoMathRandSeed (u32 a_Seed) |
| Seeds the random number generator. | |
Variables | |
| u32 * | s_RandNext |
| Internal use only. | |
| s32 | s_RandLeft |
| Internal use only. | |
| u32 | s_RandState [SO_RAND_STATE_VECTOR_LENGTH+1] |
| Internal use only. | |
|
|
Mask all but highest bit of u.
For internal use only.
|
|
|
Mask all but lowest bit of u.
For internal use only.
|
|
|
Mask the highest bit of u.
For internal use only.
|
|
|
Move hi bit of u to hi bit of v.
For internal use only.
|
|
|
For internal use only.
Reloads the Mersenne Twister state vector. Implementation taken from the internet. Credits go to Shawn J. Cokus; |
|
|
Internal use only. Used by the Mersenne Twister. Can do a *s_RandNext++ this many times before reloading; |
|
|
Internal use only. Used by the Mersenne Twister. The next random value is computed from here; |
|
|
Internal use only. Used by the Mersenne Twister. Random state vector + 1 extra to not violate ANSI C; |