The SGADE Documentation

the SGADE 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.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoMath.h File Reference

#include "SoSystem.h"
#include "SoDebug.h"

Go to the source code of this file.

Defines

#define SO_FIXED_Q
 Number of bits reserved for the fraction in fixed point numbers.

#define SO_FIXED_PI
 PI a.k.a. 3.14 etc. in a fixed point format.

#define SO_MIN(x, y)
 Returns the minimum of a pair of numbers.

#define SO_MAX(x, y)
 Returns the maximum of a pair of numbers.

#define SO_ABS(x)
 Returns the absolute value of a number.

#define SO_NUMBER_IS_EVEN(n)
 Evaluates to true when a number is even, false otherwise.

#define SO_NUMBER_IS_UNEVEN(n)
 Evaluates to false when a number is even, true otherwise.

#define SO_FIXED_FROM_WHOLE(n)
 Converts a whole (integer) number to a fixedpoint number.

#define SO_FIXED_TO_WHOLE(n)
 Converts a fixed point number to a whole number. Cuts of the fraction.

#define SO_FIXED_FROM_FLOAT(n)
 Converts a whole number to a fixedpoint number.

#define SO_FIXED_TO_FLOAT(n)
 Converts a fixed point number to a whole number.

#define SO_FIXED_TO_FRACTION(n)
 Leaves only the fraction of a fixed point number.

#define SO_FIXED_MAKE_WHOLE(n)
 Makes a fixed point number whole.

#define SO_FIXED_CEIL_WHOLE(n)
 Returns the whole ceiling of the fixed point number.

#define SO_FIXED_TO_N_8_FORMAT(n)
 Converts our fixed point format to a 24.8 format.

#define SO_FIXED_MULTIPLY_SMALL_SMALL(n, m)
 NOTE: all of the SO_FIXED_MULTIPLY_* macros are very sensitive to input data.

#define SO_FIXED_MULTIPLY_BIG_SMALL(big, small)
 Multiply macro to multiply a relatively small fixed point number by a relatively big one.

#define SO_FIXED_MULTIPLY(n, m)
 Multiply macro to multiply two fixed point numbers.

#define SO_FIXED_DIVIDE_SMALL_BIG(n, m)
 Divide macro to divide a small fixed number by a big fixed point number.

#define SO_FIXED_DIVIDE(n, m)
 Divide macro to divide a fixed point number by another fixed point number.

#define SO_FIXED_ONE_OVER_FAST_INACCURATE(n)
 One-over macro that uses a repricocal-table.

#define SO_FIXED_ONE_OVER_SLOW_ACCURATE(n)
 Macro to calculate one-over-N the slow and accurate way.

#define SO_SINE(n)
 Returns the fixed point sine of an angle. A full circle is 256 degrees.

#define SO_COSINE(n)
 Returns the fixed point cosine of an angle.


Functions

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.

void SoMathRandSeed (u32 a_Seed)
 Seeds the random number generator.

u32 SoMathRand (void)
 Returns a pseudo random number.

s32 SoMathDivideAndModulus (s32 a_Numerator, s32 a_Denominator, s32 *a_Remainder)
 Fast divide and modulus function.

s32 SoMathModulus (s32 a_Numerator, s32 a_Denominator)
 Fast modulus function.

s32 SoMathDivide (s32 a_Numerator, s32 a_Denominator)
 Fast divide function.


Detailed Description

Copyright (C) 2002 by the SGADE authors For conditions of distribution and use, see copyright notice in SoLicense.txt

Author:
Jaap Suter, Mark T. Price
Date:
April 3, 2003

Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.