Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Fixed.h File Reference


Defines

#define oneSInt16Frac   (1 << 14)
#define halfSInt16Frac   (1 << 13)
#define CP_Fixed2SInt16Frac(x)   ((x) + 2 >> 2)
#define ff(x)   ((CP_Fixed)(x) << 16)
#define INT_TO_FIXED(i)   ((i) << 16)
#define FIXED_TO_INT(f)   ((f) >> 16)
#define FIXED_TO_FLOAT(f)   (((double) (f)) * 1.52587890625e-5)
#define FLOAT_TO_FIXED(f)   ((CP_Fixed) ((f) * 65536.0))
#define FIXED_ABS(f)   ((f) < 0 ? -(f) : (f))
#define FIXED_TRUNC(f)   ((f) & 0xffff0000)
#define FIXED_SIGN(f)   ((unsigned int) (f) >> 31)
#define FIXED_PRODUCT_SIGN(f, g)   ((unsigned int) ((f) ^ (g)) >> 31)
#define FIXED_HALF(f)   ((f) / 2)
#define FIXED_DOUBLE(f)   ((f) << 1)
#define FIXED_SCALE(f, i)   ((f) * (i))
#define FIXED_ZERO   (INT_TO_FIXED(0))
#define FIXED_ONE   (INT_TO_FIXED(1))
#define FIXED_ONE_HALF   (FIXED_HALF(FIXED_ONE))
#define FIXED_PI   (FLOAT_TO_FIXED(3.1415926536))
#define FIXED_2PI   (FLOAT_TO_FIXED(6.2831853072))
#define FIXED_HALF_PI   (FLOAT_TO_FIXED(1.5707963268))
#define FIXED_MIN   LONG_MIN
#define FIXED_MAX   LONG_MAX
#define CP_FixMul(a, b)   ((CP_Fixed) ((double) (a) * ((double) (b)) * 1.52587890625e-5))
#define CP_FixMul2_30(a, b)   ((CP_Fixed) ((double) (a) * ((double) (b) * 9.313225746154785e-10)))
#define CP_FixDiv(a, b)   ((CP_Fixed) (((double) (a) / (double) (b)) * 65536.0))

Typedefs

typedef SInt32 CP_Fixed

Functions

CP_Fixed CP_FixRatio (SInt16 inNum, SInt16 inDenom)
SInt16 CP_FixRound (CP_Fixed inFixed)

Variables

CPLAT_Begin_Namespace_CPLAT
typedef SInt16 
LongFrac

Define Documentation

#define oneSInt16Frac   (1 << 14)
 

#define halfSInt16Frac   (1 << 13)
 

#define CP_Fixed2SInt16Frac  )     ((x) + 2 >> 2)
 

#define ff  )     ((CP_Fixed)(x) << 16)
 

#define INT_TO_FIXED  )     ((i) << 16)
 

#define FIXED_TO_INT  )     ((f) >> 16)
 

#define FIXED_TO_FLOAT  )     (((double) (f)) * 1.52587890625e-5)
 

#define FLOAT_TO_FIXED  )     ((CP_Fixed) ((f) * 65536.0))
 

#define FIXED_ABS  )     ((f) < 0 ? -(f) : (f))
 

#define FIXED_TRUNC  )     ((f) & 0xffff0000)
 

#define FIXED_SIGN  )     ((unsigned int) (f) >> 31)
 

#define FIXED_PRODUCT_SIGN f,
 )     ((unsigned int) ((f) ^ (g)) >> 31)
 

#define FIXED_HALF  )     ((f) / 2)
 

#define FIXED_DOUBLE  )     ((f) << 1)
 

#define FIXED_SCALE f,
 )     ((f) * (i))
 

#define FIXED_ZERO   (INT_TO_FIXED(0))
 

#define FIXED_ONE   (INT_TO_FIXED(1))
 

#define FIXED_ONE_HALF   (FIXED_HALF(FIXED_ONE))
 

#define FIXED_PI   (FLOAT_TO_FIXED(3.1415926536))
 

#define FIXED_2PI   (FLOAT_TO_FIXED(6.2831853072))
 

#define FIXED_HALF_PI   (FLOAT_TO_FIXED(1.5707963268))
 

#define FIXED_MIN   LONG_MIN
 

#define FIXED_MAX   LONG_MAX
 

#define CP_FixMul a,
 )     ((CP_Fixed) ((double) (a) * ((double) (b)) * 1.52587890625e-5))
 

#define CP_FixMul2_30 a,
 )     ((CP_Fixed) ((double) (a) * ((double) (b) * 9.313225746154785e-10)))
 

#define CP_FixDiv a,
 )     ((CP_Fixed) (((double) (a) / (double) (b)) * 65536.0))
 


Typedef Documentation

typedef SInt32 CP_Fixed
 


Function Documentation

CP_Fixed CP_FixRatio SInt16  inNum,
SInt16  inDenom
 

Returns a CP_Fixed number that is the ratio of the passed in numerator and demonator.

Parameters:
inNum The numerator of the fixed number.
inDenom The demonator of the fixed number.
Returns:
CP_Fixed The result of the conversion.

SInt16 CP_FixRound CP_Fixed  inFixed  ) 
 

Returns a rounded number from passed in fixed number.

Parameters:
inNum The numerator of the fixed number.
inDenom The demonator of the fixed number.
Exceptions:
none 
Returns:
SInt16 The rounded number.


Variable Documentation

CPLAT_Begin_Namespace_CPLAT typedef SInt16 LongFrac
 


Generated on Sat Sep 17 20:01:14 2005 for CPLAT by  doxygen 1.4.0