Go to the source code of this file.
Defines | |
#define | retfixed24 fixed24 |
Functions | |
fixed24 | Fixed24Mul (fixed24, fixed24) |
signed multiplication | |
fixed24 | Fixed24Div (fixed24, fixed24) |
signed division | |
double | Fixed24ToDouble (fixed24) |
General type conversion. | |
fixed24 | DoubleToFixed24 (double) |
General type conversion. |
|
|
|
General type conversion.
Definition at line 207 of file fix24.cpp. 00208 { 00209 fixed24 result ; 00210 #if 0 //defined(_M_IX86) 00211 // 00212 // This avoids the slow fix operation. Add a large number so that 00213 // the double always has the same exponent and the mantissa becomes, 00214 // in affect, a fixed point value with the value we want in the 00215 // bottom 32 bits. 00216 // 00217 // Note that we are relying on the compiler to convert this to 00218 // efficient code. 00219 // 00220 // TODO: Test! 00221 // 00222 static const double fFix = (XLONG)3<<(DBL_MANT_DIG-24-2); 00223 double F = arg+fFix; 00224 result.all = (INT32&)F ; 00225 #else 00226 result.all = INT32(arg*(1<<24)) ; 00227 #endif 00228 return result ; 00229 }
|
|
signed division
Why isn't there a Int64div32to32 function? Definition at line 163 of file fix24.cpp. 00164 { 00165 fixed24 result ; 00166 result.all = MulDiv(a.all,1<<24,b.all) ; 00167 return result ; 00168 }
|
|
signed multiplication
Definition at line 133 of file fix24.cpp. 00134 { 00135 fixed24 result; 00136 result.all = INT32((Int32x32To64(a.all,b.all)+0x800000)>>24) ; 00137 return result; 00138 }
|
|
General type conversion.
Definition at line 188 of file fix24.cpp. 00189 { 00190 return (double)a.all/(1<<24) ; 00191 }
|