#include <fixed16.h>
Public Member Functions | |
fixed16 () | |
fixed16 (const fixed16 &) | |
fixed16 (INT32) | |
fixed16 (short) | |
fixed16 (double) | |
fixed16 & | Sin () |
Performs sine on a FIXED16. | |
fixed16 & | Cos () |
Performs Cos on a FIXED16. | |
fixed16 | trunc () const |
fixed16 | round () const |
fixed16 | abs () const |
fixed16 | sgn () const |
void | ToString (StringBase *out) const |
Converts value of FIXED16 into a string representing it. The string will be ASCII or Unicode depending on the size of TCHAR. | |
fixed16 & | operator= (const fixed16 &) |
fixed16 & | operator= (const INT32) |
fixed16 & | operator= (const short) |
fixed16 & | operator= (const double) |
fixed16 & | operator+= (const fixed16 &) |
fixed16 & | operator+= (const short) |
fixed16 & | operator-= (const fixed16 &) |
fixed16 & | operator-= (const short) |
fixed16 & | operator *= (const fixed16 &) |
fixed16 & | operator *= (const short) |
fixed16 & | operator/= (const fixed16 &) |
fixed16 & | operator/= (const short) |
fixed16 & | operator<<= (const UINT32) |
fixed16 & | operator>>= (const UINT32) |
fixed16 & | operator++ () |
fixed16 | operator++ (INT32) |
fixed16 & | operator-- () |
fixed16 | operator-- (INT32) |
INT32 | MakeInt () const |
short | MakeShort () const |
double | MakeDouble () const |
INT32 | MakeLong () const |
xlong | MakeXlong () const |
INT32 | GetRawLong () const |
INT32 | GetShifted16 () const |
Static Public Member Functions | |
static fixed16 | FromRawLong (INT32 d) |
static fixed16 | FromShifted16 (INT32 d) |
Public Attributes | |
INT32 | all |
Friends | |
fixed16 | Div32By32 (const INT32 a, const INT32 b) |
fixed16 CCAPI | operator+ (const fixed16 &, const fixed16 &) |
fixed16 CCAPI | operator- (const fixed16 &, const fixed16 &) |
fixed16 CCAPI | operator- (const fixed16 &) |
fixed16 CCAPI | operator * (const fixed16 &, const fixed16 &) |
fixed16 CCAPI | operator/ (const fixed16 &, const fixed16 &) |
fixed16 CCAPI | operator>> (const fixed16 &, UINT32) |
fixed16 CCAPI | operator<< (const fixed16 &, UINT32) |
INT32 CCAPI | operator== (const fixed16 &, const fixed16 &) |
INT32 CCAPI | operator== (const fixed16 &, const short) |
INT32 CCAPI | operator!= (const fixed16 &, const fixed16 &) |
INT32 CCAPI | operator!= (const fixed16 &, const short) |
INT32 CCAPI | operator> (const fixed16 &, const fixed16 &) |
INT32 CCAPI | operator> (const fixed16 &, const short) |
INT32 CCAPI | operator< (const fixed16 &, const fixed16 &) |
INT32 CCAPI | operator< (const fixed16 &, const short) |
INT32 CCAPI | operator>= (const fixed16 &, const fixed16 &) |
INT32 CCAPI | operator>= (const fixed16 &, const short) |
INT32 CCAPI | operator<= (const fixed16 &, const fixed16 &) |
INT32 CCAPI | operator<= (const fixed16 &, const short) |
Definition at line 142 of file fixed16.h.
|
Definition at line 156 of file fixed16.h.
|
|
Definition at line 252 of file fixed16.h.
|
|
Definition at line 257 of file fixed16.h. 00258 { 00259 all = SHORT_FIXED( initValue ); 00260 }
|
|
Definition at line 262 of file fixed16.h. 00263 { 00264 all = SHORT_FIXED( initValue ); 00265 }
|
|
Definition at line 267 of file fixed16.h. 00268 { 00269 *this = DoubleToFixed16(initValue); 00270 }
|
|
Definition at line 345 of file fixed16.h. 00346 { 00347 return FromRawLong( all<0 ? -all : all ); 00348 }
|
|
Performs Cos on a FIXED16.
Definition at line 313 of file f16spec.cpp. 00314 { 00315 #ifndef WIN32 00316 if (MathCoprocInstalled) //Is MathCoprocessor installed 00317 *this = Fixed16Cos(*this); 00318 else 00319 #endif 00320 *this = cos(TORADIANS(this->MakeDouble())); 00321 00322 ERROR3("Alex doubts whether this routine works"); 00323 00324 return *this; 00325 }
|
|
Definition at line 272 of file fixed16.h.
|
|
Definition at line 279 of file fixed16.h.
|
|
Definition at line 325 of file fixed16.h. 00326 { 00327 return this->all; 00328 }
|
|
Definition at line 330 of file fixed16.h. 00331 { 00332 return this->all; 00333 }
|
|
Definition at line 314 of file fixed16.h. 00315 { 00316 return Fixed16ToDouble(*this); 00317 }
|
|
Definition at line 286 of file fixed16.h.
|
|
Definition at line 296 of file fixed16.h.
|
|
Definition at line 291 of file fixed16.h.
|
|
Definition at line 301 of file fixed16.h.
|
|
Definition at line 509 of file fixed16.h. 00510 { 00511 fixed16 temp; 00512 00513 temp.all = SHORT_FIXED( operand ); 00514 00515 F16ASSIGNTHIS = Fixed16Mul(*this, temp); 00516 00517 return *this; 00518 }
|
|
Definition at line 502 of file fixed16.h. 00503 { 00504 F16ASSIGNTHIS = Fixed16Mul(*this, operand); 00505 00506 return *this; 00507 }
|
|
Definition at line 556 of file fixed16.h. 00557 { 00558 fixed16 result = *this; 00559 00560 this->all += FIXED16_ONE; 00561 00562 return result; 00563 }
|
|
Definition at line 550 of file fixed16.h. 00551 { 00552 this->all += FIXED16_ONE; 00553 return *this; 00554 }
|
|
Definition at line 484 of file fixed16.h. 00485 { 00486 this->all += SHORT_FIXED( operand ); 00487 return *this; 00488 }
|
|
Definition at line 478 of file fixed16.h.
|
|
Definition at line 571 of file fixed16.h. 00572 { 00573 fixed16 result = *this; 00574 00575 this->all -= FIXED16_ONE; 00576 00577 return result; 00578 }
|
|
Definition at line 565 of file fixed16.h. 00566 { 00567 this->all -= FIXED16_ONE; 00568 return *this; 00569 }
|
|
Definition at line 496 of file fixed16.h. 00497 { 00498 this->all -= SHORT_FIXED( operand ); 00499 return *this; 00500 }
|
|
Definition at line 490 of file fixed16.h.
|
|
Definition at line 527 of file fixed16.h. 00528 { 00529 fixed16 temp; 00530 00531 temp.all = SHORT_FIXED( operand ); 00532 00533 F16ASSIGNTHIS = Fixed16Div(*this, temp); 00534 00535 return *this; 00536 }
|
|
Definition at line 520 of file fixed16.h. 00521 { 00522 F16ASSIGNTHIS = Fixed16Div(*this, operand); 00523 00524 return *this; 00525 }
|
|
Definition at line 538 of file fixed16.h. 00539 { 00540 this->all <<= operand; 00541 return *this; 00542 }
|
|
Definition at line 472 of file fixed16.h. 00473 { 00474 F16ASSIGNTHIS = DoubleToFixed16(operand); 00475 return *this; 00476 }
|
|
Definition at line 319 of file fixed16.h. 00320 { 00321 this->all = SHORT_FIXED( operand ); 00322 return *this; 00323 }
|
|
Definition at line 466 of file fixed16.h. 00467 { 00468 this->all = SHORT_FIXED( operand ); 00469 return *this; 00470 }
|
|
Definition at line 307 of file fixed16.h.
|
|
Definition at line 544 of file fixed16.h. 00545 { 00546 this->all >>= operand; 00547 return *this; 00548 }
|
|
Definition at line 340 of file fixed16.h. 00341 { 00342 return FromRawLong( ( all + FIXED16_HALF ) & 0xFFFF0000L ); 00343 }
|
|
Definition at line 350 of file fixed16.h. 00351 { 00352 return FromRawLong( all<0 ? -FIXED16_ONE : FIXED16_ONE ); 00353 }
|
|
Performs sine on a FIXED16.
Definition at line 283 of file f16spec.cpp. 00284 { 00285 #ifndef WIN32 00286 if (MathCoprocInstalled) //Is MathCoprocessor installed 00287 *this = Fixed16Sin(*this); 00288 else 00289 #endif 00290 *this = sin(TORADIANS(this->MakeDouble())); 00291 00292 ERROR3("Alex doubts whether this routine works"); 00293 00294 return *this; 00295 }
|
|
Converts value of FIXED16 into a string representing it. The string will be ASCII or Unicode depending on the size of TCHAR.
Definition at line 120 of file fixed16.cpp. 00121 { 00122 // Allocate some working storage etc. 00123 TCHAR buf[32]; 00124 TCHAR* pch = buf; 00125 INT32 n = all; 00126 00127 // If the number is negative then output a sign and make it positive. 00128 if (n < 0) 00129 { 00130 *pch++ = TEXT('-'); 00131 n = -n; 00132 } 00133 00134 // Convert and output the integer part of the number. 00135 pch += camSnprintf( pch, 256, TEXT("%u"), unsigned(n >> F16SHIFT) ); 00136 00137 // Mask off the fractional part, converting it if it exists. 00138 n &= (1uL << F16SHIFT) - 1; 00139 if (n != 0) 00140 { 00141 // Output a decimal point. 00142 *pch++ = TEXT('.'); 00143 00144 // "Normalise" into an integer by multiplying by 100000/65336. 00145 n = MulDiv32By32(n, 100000L, 65536L); 00146 00147 // Convert and output. We must do this ourselves as we must take 00148 // account of leading zeros. 00149 INT32 nPowerTen = 10000L; 00150 while (nPowerTen > 0) 00151 { 00152 // Is the remaining part of the number greater than our power of ten? 00153 if (n >= nPowerTen) 00154 { 00155 // Output a non-zero digit and subtract the closest multiple of the 00156 // power of ten. 00157 INT32 nFactor = n / nPowerTen; 00158 *pch++ = TEXT('0') + TCHAR(nFactor); 00159 n -= (n * nFactor); 00160 } 00161 else 00162 { 00163 // Output a leading zero. 00164 *pch++ = TEXT('0'); 00165 } 00166 00167 // Go on to the next highest power of ten. 00168 nPowerTen /= 10; 00169 } 00170 } 00171 00172 // Terminate and write into the output parameter. 00173 *pch = TEXT('\0'); 00174 *pOut = buf; 00175 }
|
|
Definition at line 335 of file fixed16.h. 00336 { 00337 return FromRawLong( all & 0xFFFF0000L ); 00338 }
|
|
Definition at line 134 of file ccmaths.h. 00135 { 00136 fixed16 v( InternalDiv32by32( a, b ) ); 00137 return v; 00138 }
|
|
Definition at line 376 of file fixed16.h. 00377 { 00378 fixed16 result; 00379 F16ASSIGN(result) = Fixed16Mul( operand1, operand2 ); 00380 return result; 00381 }
|
|
Definition at line 421 of file fixed16.h. 00422 { 00423 return operand1.all != SHORT_FIXED( operand2 ); 00424 }
|
|
Definition at line 416 of file fixed16.h.
|
|
Definition at line 355 of file fixed16.h. 00356 { 00357 fixed16 result; 00358 result.all = operand1.all + operand2.all; 00359 return result; 00360 }
|
|
Definition at line 369 of file fixed16.h.
|
|
Definition at line 362 of file fixed16.h. 00363 { 00364 fixed16 result; 00365 result.all = operand1.all - operand2.all; 00366 return result; 00367 }
|
|
Definition at line 383 of file fixed16.h. 00384 { 00385 fixed16 result; 00386 F16ASSIGN(result) = Fixed16Div( operand1, operand2 ); 00387 return result; 00388 }
|
|
Definition at line 441 of file fixed16.h. 00442 { 00443 return operand1.all < SHORT_FIXED( operand2 ); 00444 }
|
|
Definition at line 436 of file fixed16.h.
|
|
Definition at line 397 of file fixed16.h. 00398 { 00399 fixed16 result; 00400 00401 result.all = operand1.all << operand2; 00402 00403 return result; 00404 }
|
|
Definition at line 461 of file fixed16.h. 00462 { 00463 return operand1.all <= SHORT_FIXED( operand2 ); 00464 }
|
|
Definition at line 456 of file fixed16.h.
|
|
Definition at line 411 of file fixed16.h. 00412 { 00413 return operand1.all == SHORT_FIXED( operand2 ); 00414 }
|
|
Definition at line 406 of file fixed16.h.
|
|
Definition at line 431 of file fixed16.h. 00432 { 00433 return operand1.all > SHORT_FIXED(operand2); 00434 }
|
|
Definition at line 426 of file fixed16.h.
|
|
Definition at line 451 of file fixed16.h. 00452 { 00453 return operand1.all >= SHORT_FIXED( operand2 ); 00454 }
|
|
Definition at line 446 of file fixed16.h.
|
|
Definition at line 390 of file fixed16.h. 00391 { 00392 fixed16 result; 00393 result.all = operand1.all >> operand2; 00394 return result; 00395 }
|
|
|