BurgerLib
Classes | Namespaces | Defines | Typedefs | Variables
fxfixed.h File Reference
#include "brtypes.h"
Include dependency graph for fxfixed.h:
This graph shows which files directly or indirectly include this file:

Classes

class  Burger::IntMath
 Helper routines for integer math. More...
class  Burger::FixedMath
 Functions to handle fixed point integer math. More...
class  Burger::FracMath
 Functions to handle Frac point integer math. More...
struct  Burger::FixedVector2D_t
 A 2D Fixed32 vector. More...
struct  Burger::FixedVector3D_t
 3D Fixed32 vector. More...
struct  Burger::FixedVector4D_t
 4D Fixed32 vector. More...
struct  Burger::FixedMatrix3D_t
 3x3 Fixed32 matrix. More...
struct  Burger::FixedMatrix4D_t
 4x4 Fixed32 matrix. More...

Namespaces

namespace  Burger

Defines

#define FLOATTOFIXED(x)   static_cast<Fixed32>((x)*65536.0f)
 Define to convert a float into a Fixed32.
#define FIXEDTOFLOAT(x)   static_cast<float>((x)*(1.0f/65536.0f))
 Define to convert a Fixed32 into a float.
#define INTTOFIXED(x)   static_cast<Fixed32>((x)<<16)
 Define to convert a integer into a Fixed32.
#define FIXEDTOINT(x)   static_cast<int>((x+((x>>31)&0xFFFF))>>16)
 Define to convert a Fixed32 value to an integer.

Typedefs

typedef char Burger::Float80Bit [10]
 80 bit float (Extended)

Variables

const float g_fBurgerIntMathNearesttable [2]
 Helper constants for float to integer conversions.
const float g_fBurgerMath65536
 Floating point constant of 65536.0f.
const Word16 Burger::MaxWord16 = 0xFFFFU
 Maximum value for Word16 (Minimum is 0)
const Word32 Burger::MaxWord32 = 0xFFFFFFFFUL
 Maximum value for Word32 (Minimum is 0)
const Int16 Burger::MinInt16 = (-0x7FFF)-1
 Minimum value for Int16.
const Int16 Burger::MaxInt16 = 0x7FFF
 Maximum value for Int16.
const Int32 Burger::MinInt32 = (-0x7FFFFFFFL)-1
 Minimum value for Int32.
const Int32 Burger::MaxInt32 = 0x7FFFFFFFL
 Maximum value for Int32.
const Frac32 Burger::MinFrac32 = (-0x7FFFFFFFL)-1
 Minimum value for Frac32.
const Frac32 Burger::MaxFrac32 = 0x7FFFFFFFL
 Maximum value for Frac32.
const Fixed32 Burger::MinFixed32 = (-0x7FFFFFFFL)-1
 Minimum value for Fixed32.
const Fixed32 Burger::MaxFixed32 = 0x7FFFFFFFL
 Maximum value for Fixed32.
const Fixed32 Burger::PiFixed32 = 0x0032440L
 Pi in Fixed32 format (3.141...)

Define Documentation

#define FIXEDTOFLOAT (   x)    static_cast<float>((x)*(1.0f/65536.0f))

Define to convert a Fixed32 into a float.

Macro to convert at compile time a 16.16 fixed point number into a floating point value Used for compile assignment of float constants using Fixed32 constants..

Parameters:
x16.16 fixed point value to convert to a float.
Note:
Due to the integer to float conversion, use of this macro at runtime may be a performance penalty on the Xbox 360 and PS3.
    static const float MyData = FIXEDTOFLOAT(Burger::PiFixed32);
#define FIXEDTOINT (   x)    static_cast<int>((x+((x>>31)&0xFFFF))>>16)

Define to convert a Fixed32 value to an integer.

Macro to convert at compile time a 16.16 fixed point value into an integer. Used for compile time assignment of integers using Fixed32 constants.

Parameters:
xFixed32 value to convert to an integer.
Note:
This macro uses round to zero in the removal of the fraction. Negative numbers like -0.8 become 0, as well as 0.8 becomes 0.
    static const int MyData = FIXEDTOINT(Burger::PiFixed32);
#define FLOATTOFIXED (   x)    static_cast<Fixed32>((x)*65536.0f)

Define to convert a float into a Fixed32.

Macro to convert at compile time a floating point value into 16.16 fixed point. Used for compile assignment of Fixed32 constants.

Parameters:
xFloating point value to convert to a Fixed32.
Note:
Due to the float to integer conversion, use of this macro at runtime may be a performance penalty on the Xbox 360 and PS3.
    static const Fixed32 MyData = FLOATTOFIXED(4.503f);
#define INTTOFIXED (   x)    static_cast<Fixed32>((x)<<16)

Define to convert a integer into a Fixed32.

Macro to convert at compile time an integer value into 16.16 fixed point. Used for compile assignment of Fixed32 constants.

Parameters:
xInteger value to convert to a Fixed32.
Note:
There is no bounds checking performed by this macro. As a result, integers larger than 32767 or less than -32768 will call undefined behavior due to over/underflow.
    static const Fixed32 MyData = INTTOFIXED(443);

Variable Documentation

Helper constants for float to integer conversions.

These constants are used for the translation of floats to ints using floor, ceil or zero. The first constant is added to yield floor() and the second is for getting ceil() (1.0f/(65536.0f*256.0f)) is the 32-bit floating point epsilon just under 1.0f

See also:
Burger::IntMath::FromFloat(float) or Burger::IntMath::FromFloatFloor(float)
const float g_fBurgerMath65536

Floating point constant of 65536.0f.