fixed.cpp File Reference

#include "fixed.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <common/DefinesAssert.h>
#include <common/DefinesString.h>
#include <common/Logger.h>

Go to the source code of this file.

Defines

#define _XPI   31415
#define _X2PI   62831
#define _XPIO2   15707
#define _XPIO4   7853
#define XPIO4   fixed(true, _XPIO4)
#define _XLN_E   27182
#define XLN_E   fixed(true,_XLN_E)
#define _XLN_10   23025
#define XLN_10   fixed(true,_XLN_10)
#define sqrt_step(shift)

Functions

int fixed_internal_mult (int a, int b)
int fixed_internal_div (int a, int b)
static int iSqrt (int value)
fixed absx (fixed p_Base)
static fixed iLog2 (fixed p_Base)
static fixed iExp2 (fixed p_Base)
static fixed ipow (fixed p_Base, fixed p_Power)
static fixed ilog10 (fixed p_Base)
fixed sqrtx (fixed fixedVal)
fixed powx (fixed fixedVal, fixed fixedPower)
fixed expx (fixed fixedVal)
fixed log10x (fixed fixedVal)
fixed logx (fixed fixedVal)
fixed floorx (fixed fixedVal)
fixed ceilx (fixed fixedVal)
static fixed _sinx (fixed x)
fixed sinx (fixed x)
fixed cosx (fixed x)
fixed tanx (fixed x)
static fixed _atanx (fixed f, int n)
fixed atanx (fixed x)
fixed atan2x (fixed v, fixed u)

Variables

static fixed CON1 (true, 2679)
static fixed ROOT_3M1 (true, 7321)
static fixed ROOT_3 (true, 17321)
static fixed p0 = fixed(true, -136887)
static fixed p1 = fixed(true, -205058)
static fixed p2 = fixed(true, -84946)
static fixed p3 = fixed(true, -8375)
static fixed q0 = fixed(true, 410663)
static fixed q1 = fixed(true, 861573)
static fixed q2 = fixed(true, 595784)
static fixed q3 = fixed(true, 150240)
static fixed at []


Define Documentation

#define _X2PI   62831

Definition at line 34 of file fixed.cpp.

Referenced by fixed::cos(), and fixed::sin().

#define _XLN_10   23025

Definition at line 42 of file fixed.cpp.

#define _XLN_E   27182

Definition at line 40 of file fixed.cpp.

#define _XPI   31415

Definition at line 32 of file fixed.cpp.

#define _XPIO2   15707

Definition at line 36 of file fixed.cpp.

Referenced by fixed::cos().

#define _XPIO4   7853

Definition at line 38 of file fixed.cpp.

#define sqrt_step ( shift   ) 

Value:

if((0x40000000l >> shift) + root <= value)          \
    {                                                   \
        value -= (0x40000000l >> shift) + root;         \
        root = (root >> 1) | (0x40000000l >> shift);    \
    }                                                   \
    else                                                \
    {                                                   \
        root = root >> 1;                               \
    }

Definition at line 191 of file fixed.cpp.

Referenced by iSqrt(), iSqrtL(), and iSqrtLL().

#define XLN_10   fixed(true,_XLN_10)

Definition at line 43 of file fixed.cpp.

Referenced by ilog10().

#define XLN_E   fixed(true,_XLN_E)

Definition at line 41 of file fixed.cpp.

Referenced by iLog2().

#define XPIO4   fixed(true, _XPIO4)

Definition at line 39 of file fixed.cpp.


Function Documentation

static fixed _atanx ( fixed  f,
int  n 
) [static]

Definition at line 521 of file fixed.cpp.

References CON1, fixed::fixed(), ROOT_3, and ROOT_3M1.

Referenced by atan2x(), and atanx().

static fixed _sinx ( fixed  x  )  [static]

Definition at line 380 of file fixed.cpp.

References fixed::fixed().

Referenced by fixed::cos(), and fixed::sin().

fixed absx ( fixed  p_Base  ) 

Definition at line 233 of file fixed.cpp.

Referenced by iLog2(), and ipow().

fixed atan2x ( fixed  v,
fixed  u 
)

Definition at line 550 of file fixed.cpp.

Referenced by WeaponRedirect::fireWeapon(), TankLib::getShotTowardsPosition(), TankLib::getSniperShotTowardsPosition(), TankMovement::init(), TankAIAimGuesser::refineShot(), TargetMovementEntrySpline::simulate(), TargetMovementEntryShips::simulate(), and Boid2::update().

fixed atanx ( fixed  x  ) 

Definition at line 541 of file fixed.cpp.

fixed ceilx ( fixed  fixedVal  ) 

Definition at line 367 of file fixed.cpp.

fixed cosx ( fixed  x  ) 

Definition at line 478 of file fixed.cpp.

fixed expx ( fixed  fixedVal  ) 

Definition at line 331 of file fixed.cpp.

int fixed_internal_div ( int  a,
int  b 
) [inline]

Definition at line 61 of file fixed.cpp.

References FIXED_RESOLUTION, and int().

Referenced by fixed::operator/(), and fixed::operator/=().

int fixed_internal_mult ( int  a,
int  b 
) [inline]

Definition at line 47 of file fixed.cpp.

References FIXED_RESOLUTION, and int().

Referenced by fixed::operator *(), and fixed::operator *=().

fixed floorx ( fixed  fixedVal  ) 

Definition at line 362 of file fixed.cpp.

static fixed iExp2 ( fixed  p_Base  )  [static]

Definition at line 279 of file fixed.cpp.

References fixed::fixed().

Referenced by fixed::exp(), and ipow().

static fixed ilog10 ( fixed  p_Base  )  [static]

Definition at line 299 of file fixed.cpp.

References iLog2(), and XLN_10.

Referenced by fixed::log10().

static fixed iLog2 ( fixed  p_Base  )  [static]

Definition at line 245 of file fixed.cpp.

References absx(), fixed::fixed(), and XLN_E.

Referenced by ilog10(), ipow(), and fixed::log().

static fixed ipow ( fixed  p_Base,
fixed  p_Power 
) [static]

Definition at line 291 of file fixed.cpp.

References absx(), fixed::fixed(), iExp2(), and iLog2().

Referenced by fixed::pow().

static int iSqrt ( int  value  )  [static]

Definition at line 202 of file fixed.cpp.

References sqrt_step.

Referenced by fixed::sqrt().

fixed log10x ( fixed  fixedVal  ) 

Definition at line 341 of file fixed.cpp.

fixed logx ( fixed  fixedVal  ) 

Definition at line 357 of file fixed.cpp.

fixed powx ( fixed  fixedVal,
fixed  fixedPower 
)

Definition at line 321 of file fixed.cpp.

fixed sinx ( fixed  x  ) 

Definition at line 439 of file fixed.cpp.

fixed sqrtx ( fixed  fixedVal  ) 

Definition at line 311 of file fixed.cpp.

fixed tanx ( fixed  x  ) 

Definition at line 488 of file fixed.cpp.


Variable Documentation

fixed at[] [static]

Initial value:

 
{
    0,
    fixed(true, 5235),          
        fixed::XPIO2,                   
    fixed(true, 10472)          
}

Definition at line 513 of file fixed.cpp.

Referenced by TargetCamera::moveCamera(), and TargetCamera::resetCam().

fixed CON1(true, 2679) [static]

Referenced by _atanx().

fixed p0 = fixed(true, -136887) [static]

Definition at line 504 of file fixed.cpp.

fixed p1 = fixed(true, -205058) [static]

Definition at line 505 of file fixed.cpp.

Referenced by Hemisphere::draw(), Hemisphere::drawColored(), and ServerWebHandler::StatsHandler::processRequest().

fixed p2 = fixed(true, -84946) [static]

Definition at line 506 of file fixed.cpp.

Referenced by Hemisphere::draw(), Hemisphere::drawColored(), and ServerWebHandler::StatsHandler::processRequest().

fixed p3 = fixed(true, -8375) [static]

Definition at line 507 of file fixed.cpp.

fixed q0 = fixed(true, 410663) [static]

Definition at line 508 of file fixed.cpp.

fixed q1 = fixed(true, 861573) [static]

Definition at line 509 of file fixed.cpp.

Referenced by Bone::getRotationAtTime().

fixed q2 = fixed(true, 595784) [static]

Definition at line 510 of file fixed.cpp.

Referenced by Bone::getRotationAtTime().

fixed q3 = fixed(true, 150240) [static]

Definition at line 511 of file fixed.cpp.

fixed ROOT_3(true, 17321) [static]

Referenced by _atanx().

fixed ROOT_3M1(true, 7321) [static]

Referenced by _atanx().


Generated on Mon Feb 16 15:14:57 2009 for Scorched3D by  doxygen 1.5.3