Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

fastmath.cpp File Reference

#include "..\Headers\fastmath.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <wtypes.h>

Compounds

union  FastSqrtUnion
struct  Vec3

Defines

#define FP_BITS(fp)   (*(DWORD *)&(fp))
#define FP_ABS_BITS(fp)   (FP_BITS(fp)&0x7FFFFFFF)
#define FP_SIGN_BIT(fp)   (FP_BITS(fp)&0x80000000)
#define FP_ONE_BITS   0x3F800000
#define FP_INV(r, p)
#define FP_INV2(r, p)
#define FP_EXP(e, p)
#define FP_NORM_TO_BYTE(i, p)

Typedefs

typedef FastSqrtUnion FastSqrtUnion

Functions

unsigned long FP_NORM_TO_BYTE2 (float p)
unsigned long FP_NORM_TO_BYTE3 (float p)
void build_sqrt_table ()
float fastsqrt (float n)
float CylTest_CapsFirst (const Vec3 &pt1, const Vec3 &pt2, float lengthsq, float radius_sq, const Vec3 &testpt)

Variables

float two = 2.0f

Define Documentation

#define FP_ABS_BITS fp       (FP_BITS(fp)&0x7FFFFFFF)
 

#define FP_BITS fp       (*(DWORD *)&(fp))
 

#define FP_EXP e,
 
 

Value:

{                                                                            \
    int _i;                                                                  \
    e = -1.44269504f * (float)0x00800000 * (p);                              \
    _i = (int)e + 0x3F800000;                                                \
    e = *(float *)&_i;                                                       \
}

#define FP_INV r,
 
 

Value:

{                                                                            \
    int _i = 2 * FP_ONE_BITS - *(int *)&(p);                                 \
    r = *(float *)&_i;                                                       \
    r = r * (2.0f - (p) * r);                                                \
}

#define FP_INV2 r,
 
 

Value:

{                                        \
    __asm { mov     eax,0x7F000000    }; \
    __asm { sub     eax,dword ptr [p] }; \
    __asm { mov     dword ptr [r],eax }; \
    __asm { fld     dword ptr [p]     }; \
    __asm { fmul    dword ptr [r]     }; \
    __asm { fsubr   [two]             }; \
    __asm { fmul    dword ptr [r]     }; \
    __asm { fstp    dword ptr [r]     }; \
}

#define FP_NORM_TO_BYTE i,
 
 

Value:

{                                                                            \
    float _n = (p) + 1.0f;                                                   \
    i = *(int *)&_n;                                                         \
    if (i >= 0x40000000)     i = 0xFF;                                       \
    else if (i <=0x3F800000) i = 0;                                          \
    else i = ((i) >> 15) & 0xFF;                                             \
}

#define FP_ONE_BITS   0x3F800000
 

#define FP_SIGN_BIT fp       (FP_BITS(fp)&0x80000000)
 


Typedef Documentation

typedef union FastSqrtUnion FastSqrtUnion
 


Function Documentation

float CylTest_CapsFirst const Vec3   pt1,
const Vec3   pt2,
float    lengthsq,
float    radius_sq,
const Vec3   testpt
 

unsigned long FP_NORM_TO_BYTE2 float    p [inline]
 

unsigned long FP_NORM_TO_BYTE3 float    p [inline]
 

void build_sqrt_table  
 

float fastsqrt float    n [inline]
 


Variable Documentation

float two = 2.0f
 


Generated on Thu May 23 17:51:00 2002 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001