doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Functions
Math.h File Reference

Go to the source code of this file.

Classes

class  idMath
 
union  idMath::_flint
 

Macros

#define DEG2RAD(a)   ( (a) * idMath::M_DEG2RAD )
 
#define RAD2DEG(a)   ( (a) * idMath::M_RAD2DEG )
 
#define SEC2MS(t)   ( idMath::FtoiFast( (t) * idMath::M_SEC2MS ) )
 
#define MS2SEC(t)   ( (t) * idMath::M_MS2SEC )
 
#define ANGLE2SHORT(x)   ( idMath::FtoiFast( (x) * 65536.0f / 360.0f ) & 65535 )
 
#define SHORT2ANGLE(x)   ( (x) * ( 360.0f / 65536.0f ) )
 
#define ANGLE2BYTE(x)   ( idMath::FtoiFast( (x) * 256.0f / 360.0f ) & 255 )
 
#define BYTE2ANGLE(x)   ( (x) * ( 360.0f / 256.0f ) )
 
#define FLOATSIGNBITSET(f)   ((*(const unsigned long *)&(f)) >> 31)
 
#define FLOATSIGNBITNOTSET(f)   ((~(*(const unsigned long *)&(f))) >> 31)
 
#define FLOATNOTZERO(f)   ((*(const unsigned long *)&(f)) & ~(1<<31) )
 
#define INTSIGNBITSET(i)   (((const unsigned long)(i)) >> 31)
 
#define INTSIGNBITNOTSET(i)   ((~((const unsigned long)(i))) >> 31)
 
#define FLOAT_IS_NAN(x)   (((*(const unsigned long *)&x) & 0x7f800000) == 0x7f800000)
 
#define FLOAT_IS_INF(x)   (((*(const unsigned long *)&x) & 0x7fffffff) == 0x7f800000)
 
#define FLOAT_IS_IND(x)   ((*(const unsigned long *)&x) == 0xffc00000)
 
#define FLOAT_IS_DENORMAL(x)
 
#define IEEE_FLT_MANTISSA_BITS   23
 
#define IEEE_FLT_EXPONENT_BITS   8
 
#define IEEE_FLT_EXPONENT_BIAS   127
 
#define IEEE_FLT_SIGN_BIT   31
 
#define IEEE_DBL_MANTISSA_BITS   52
 
#define IEEE_DBL_EXPONENT_BITS   11
 
#define IEEE_DBL_EXPONENT_BIAS   1023
 
#define IEEE_DBL_SIGN_BIT   63
 
#define IEEE_DBLE_MANTISSA_BITS   63
 
#define IEEE_DBLE_EXPONENT_BITS   15
 
#define IEEE_DBLE_EXPONENT_BIAS   0
 
#define IEEE_DBLE_SIGN_BIT   79
 

Functions

template<class T >
ID_INLINE int MaxIndex (T x, T y)
 
template<class T >
ID_INLINE int MinIndex (T x, T y)
 
template<class T >
ID_INLINE T Max3 (T x, T y, T z)
 
template<class T >
ID_INLINE T Min3 (T x, T y, T z)
 
template<class T >
ID_INLINE int Max3Index (T x, T y, T z)
 
template<class T >
ID_INLINE int Min3Index (T x, T y, T z)
 
template<class T >
ID_INLINE T Sign (T f)
 
template<class T >
ID_INLINE T Square (T x)
 
template<class T >
ID_INLINE T Cube (T x)
 

Macro Definition Documentation

#define ANGLE2BYTE (   x)    ( idMath::FtoiFast( (x) * 256.0f / 360.0f ) & 255 )

Definition at line 65 of file Math.h.

#define ANGLE2SHORT (   x)    ( idMath::FtoiFast( (x) * 65536.0f / 360.0f ) & 65535 )

Definition at line 62 of file Math.h.

#define BYTE2ANGLE (   x)    ( (x) * ( 360.0f / 256.0f ) )

Definition at line 66 of file Math.h.

#define DEG2RAD (   a)    ( (a) * idMath::M_DEG2RAD )

Definition at line 56 of file Math.h.

#define FLOAT_IS_DENORMAL (   x)
Value:
(((*(const unsigned long *)&x) & 0x7f800000) == 0x00000000 && \
((*(const unsigned long *)&x) & 0x007fffff) != 0x00000000 )
GLenum GLint x
Definition: glext.h:2849

Definition at line 77 of file Math.h.

#define FLOAT_IS_IND (   x)    ((*(const unsigned long *)&x) == 0xffc00000)

Definition at line 76 of file Math.h.

#define FLOAT_IS_INF (   x)    (((*(const unsigned long *)&x) & 0x7fffffff) == 0x7f800000)

Definition at line 75 of file Math.h.

#define FLOAT_IS_NAN (   x)    (((*(const unsigned long *)&x) & 0x7f800000) == 0x7f800000)

Definition at line 74 of file Math.h.

#define FLOATNOTZERO (   f)    ((*(const unsigned long *)&(f)) & ~(1<<31) )

Definition at line 70 of file Math.h.

#define FLOATSIGNBITNOTSET (   f)    ((~(*(const unsigned long *)&(f))) >> 31)

Definition at line 69 of file Math.h.

#define FLOATSIGNBITSET (   f)    ((*(const unsigned long *)&(f)) >> 31)

Definition at line 68 of file Math.h.

#define IEEE_DBL_EXPONENT_BIAS   1023

Definition at line 87 of file Math.h.

#define IEEE_DBL_EXPONENT_BITS   11

Definition at line 86 of file Math.h.

#define IEEE_DBL_MANTISSA_BITS   52

Definition at line 85 of file Math.h.

#define IEEE_DBL_SIGN_BIT   63

Definition at line 88 of file Math.h.

#define IEEE_DBLE_EXPONENT_BIAS   0

Definition at line 92 of file Math.h.

#define IEEE_DBLE_EXPONENT_BITS   15

Definition at line 91 of file Math.h.

#define IEEE_DBLE_MANTISSA_BITS   63

Definition at line 90 of file Math.h.

#define IEEE_DBLE_SIGN_BIT   79

Definition at line 93 of file Math.h.

#define IEEE_FLT_EXPONENT_BIAS   127

Definition at line 82 of file Math.h.

#define IEEE_FLT_EXPONENT_BITS   8

Definition at line 81 of file Math.h.

#define IEEE_FLT_MANTISSA_BITS   23

Definition at line 80 of file Math.h.

#define IEEE_FLT_SIGN_BIT   31

Definition at line 83 of file Math.h.

#define INTSIGNBITNOTSET (   i)    ((~((const unsigned long)(i))) >> 31)

Definition at line 72 of file Math.h.

#define INTSIGNBITSET (   i)    (((const unsigned long)(i)) >> 31)

Definition at line 71 of file Math.h.

#define MS2SEC (   t)    ( (t) * idMath::M_MS2SEC )

Definition at line 60 of file Math.h.

#define RAD2DEG (   a)    ( (a) * idMath::M_RAD2DEG )

Definition at line 57 of file Math.h.

#define SEC2MS (   t)    ( idMath::FtoiFast( (t) * idMath::M_SEC2MS ) )

Definition at line 59 of file Math.h.

#define SHORT2ANGLE (   x)    ( (x) * ( 360.0f / 65536.0f ) )

Definition at line 63 of file Math.h.

Function Documentation

template<class T >
ID_INLINE T Cube ( T  x)

Definition at line 105 of file Math.h.

template<class T >
ID_INLINE T Max3 ( T  x,
T  y,
T  z 
)

Definition at line 98 of file Math.h.

template<class T >
ID_INLINE int Max3Index ( T  x,
T  y,
T  z 
)

Definition at line 100 of file Math.h.

template<class T >
ID_INLINE int MaxIndex ( T  x,
T  y 
)

Definition at line 95 of file Math.h.

template<class T >
ID_INLINE T Min3 ( T  x,
T  y,
T  z 
)

Definition at line 99 of file Math.h.

template<class T >
ID_INLINE int Min3Index ( T  x,
T  y,
T  z 
)

Definition at line 101 of file Math.h.

template<class T >
ID_INLINE int MinIndex ( T  x,
T  y 
)

Definition at line 96 of file Math.h.

template<class T >
ID_INLINE T Sign ( T  f)

Definition at line 103 of file Math.h.

template<class T >
ID_INLINE T Square ( T  x)

Definition at line 104 of file Math.h.