41 #ifndef __ARTKPFIXEDBASE_GENERIC_HEADERFILE__ 42 #define __ARTKPFIXEDBASE_GENERIC_HEADERFILE__ 52 template <
int PBITS_,
int CHECK_>
64 __int64 v64 = ((__int64)nInteger) <<
PBITS;
67 assert(
false &&
"Integer to Fixed-Point conversion failed: the target's range was overflowed");
73 __int64 v64 = (__int64)(nFloat * ((
float)(1 <<
PBITS) + 0.5
f));
76 assert(
false &&
"Float to Fixed-Point conversion failed: the target's range was overflowed");
82 __int64 v64 = (__int64)(nDouble * ((
double)(1 <<
PBITS) + 0.5
f));
85 assert(
false &&
"Double to Fixed-Point conversion failed: the target's range was overflowed");
91 return nFixed/(float)(1 <<
PBITS);
96 return nFixed/(double)(1 <<
PBITS);
110 return (
int)(nV * (float)(1 <<
PBITS) + 0.5f);
117 return (
int)(nV * (double)(1 <<
PBITS) + 0.5f);
122 return (__int32)(((__int64)1<<(2*
PBITS))/nFixed);
125 static int multiply(
int nLeftFixed,
int nRightFixed)
127 return (__int32)(((__int64)nLeftFixed * (__int64)nRightFixed) >>
PBITS);
130 static int divide(
int nLeftFixed,
int nRightFixed)
132 return (__int32)(((__int64)nLeftFixed <<
PBITS) / nRightFixed);
135 static int cos(
int nFixed)
140 static int sin(
int nFixed)
147 return nFixed<0 ? -nFixed : nFixed;
164 if(nFixed>=0 && ret<nFixed)
173 #endif //__ARTKPFIXEDBASE_GENERIC_HEADERFILE__ static void checkInt(int nInteger)
static int multiply(int nLeftFixed, int nRightFixed)
static int sin(int nFixed)
static int inverseSqrt(int nFixed)
static int divide(int nLeftFixed, int nRightFixed)
static int fixedFromFloat(float nV)
static int fixedFromDouble(double nV)
static int cos(int nFixed)
static int fabs(int nFixed)
static float floatFromFixed(int nFixed)
static int inverse(int nFixed)
static int ceil(int nFixed)
static double doubleFromFixed(int nFixed)
static int sqrt(int nFixed)
static void checkDouble(double nDouble)
static void checkFloat(float nFloat)
static int fixedFromInt(int nV)