#include <math.h>
#include <stdlib.h>
#include <cstdlib>
#include <cfloat>
#include <float.h>
#include <assert.h>
Go to the source code of this file.
Classes | |
struct | btTypedObject |
rudimentary class to provide type info More... | |
Defines | |
#define | ATTRIBUTE_ALIGNED128(a) a |
#define | ATTRIBUTE_ALIGNED16(a) a |
#define | ATTRIBUTE_ALIGNED64(a) a |
#define | BT_BULLET_VERSION 276 |
#define | BT_DECLARE_ALIGNED_ALLOCATOR() |
#define | BT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name |
#define | BT_LARGE_FLOAT 1e18f |
#define | btAssert(x) |
#define | btFsels(a, b, c) (btScalar)btFsel(a,b,c) |
#define | btFullAssert(x) |
#define | btLikely(_c) _c |
#define | btRecipSqrt(x) ((btScalar)(btScalar(1.0)/btSqrt(btScalar(x)))) |
#define | btUnlikely(_c) _c |
#define | SIMD_2_PI btScalar(6.283185307179586232) |
#define | SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) |
#define | SIMD_EPSILON FLT_EPSILON |
#define | SIMD_FORCE_INLINE inline |
#define | SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25)) |
#define | SIMD_INFINITY FLT_MAX |
#define | SIMD_PI (SIMD_2_PI * btScalar(0.5)) |
#define | SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) |
#define | SIMDSQRT12 btScalar(0.7071067811865475244008443621048490) |
Typedefs | |
typedef float | btScalar |
The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision. | |
Functions | |
SIMD_FORCE_INLINE btScalar | btAcos (btScalar x) |
SIMD_FORCE_INLINE btScalar | btAsin (btScalar x) |
SIMD_FORCE_INLINE btScalar | btAtan (btScalar x) |
SIMD_FORCE_INLINE btScalar | btAtan2 (btScalar x, btScalar y) |
SIMD_FORCE_INLINE btScalar | btAtan2Fast (btScalar y, btScalar x) |
SIMD_FORCE_INLINE btScalar | btCos (btScalar x) |
SIMD_FORCE_INLINE btScalar | btDegrees (btScalar x) |
SIMD_FORCE_INLINE bool | btEqual (btScalar a, btScalar eps) |
SIMD_FORCE_INLINE btScalar | btExp (btScalar x) |
SIMD_FORCE_INLINE btScalar | btFabs (btScalar x) |
SIMD_FORCE_INLINE btScalar | btFmod (btScalar x, btScalar y) |
SIMD_FORCE_INLINE btScalar | btFsel (btScalar a, btScalar b, btScalar c) |
SIMD_FORCE_INLINE bool | btFuzzyZero (btScalar x) |
int | btGetVersion () |
SIMD_FORCE_INLINE bool | btGreaterEqual (btScalar a, btScalar eps) |
SIMD_FORCE_INLINE int | btIsNegative (btScalar x) |
SIMD_FORCE_INLINE btScalar | btLog (btScalar x) |
SIMD_FORCE_INLINE bool | btMachineIsLittleEndian () |
SIMD_FORCE_INLINE btScalar | btNormalizeAngle (btScalar angleInRadians) |
SIMD_FORCE_INLINE btScalar | btPow (btScalar x, btScalar y) |
SIMD_FORCE_INLINE btScalar | btRadians (btScalar x) |
SIMD_FORCE_INLINE float | btSelect (unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero) |
SIMD_FORCE_INLINE int | btSelect (unsigned condition, int valueIfConditionNonZero, int valueIfConditionZero) |
SIMD_FORCE_INLINE unsigned | btSelect (unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero) |
SIMD_FORCE_INLINE btScalar | btSin (btScalar x) |
SIMD_FORCE_INLINE btScalar | btSqrt (btScalar y) |
template<typename T > | |
SIMD_FORCE_INLINE void | btSwap (T &a, T &b) |
SIMD_FORCE_INLINE unsigned short | btSwapEndian (short val) |
SIMD_FORCE_INLINE unsigned | btSwapEndian (int val) |
SIMD_FORCE_INLINE unsigned short | btSwapEndian (unsigned short val) |
SIMD_FORCE_INLINE unsigned | btSwapEndian (unsigned val) |
SIMD_FORCE_INLINE void | btSwapEndianDouble (double d, unsigned char *dst) |
SIMD_FORCE_INLINE unsigned int | btSwapEndianFloat (float d) |
btSwapFloat uses using char pointers to swap the endianness | |
SIMD_FORCE_INLINE btScalar | btTan (btScalar x) |
SIMD_FORCE_INLINE double | btUnswapEndianDouble (const unsigned char *src) |
SIMD_FORCE_INLINE float | btUnswapEndianFloat (unsigned int a) |
#define ATTRIBUTE_ALIGNED128 | ( | a | ) | a |
Definition at line 174 of file btScalar.h.
#define ATTRIBUTE_ALIGNED16 | ( | a | ) | a |
Definition at line 172 of file btScalar.h.
#define ATTRIBUTE_ALIGNED64 | ( | a | ) | a |
Definition at line 173 of file btScalar.h.
#define BT_BULLET_VERSION 276 |
Definition at line 33 of file btScalar.h.
#define BT_DECLARE_ALIGNED_ALLOCATOR | ( | ) |
SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \ SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \ SIMD_FORCE_INLINE void operator delete(void*, void*) { } \ SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); } \ SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \ SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \
Definition at line 210 of file btScalar.h.
#define BT_DECLARE_HANDLE | ( | name | ) | typedef struct name##__ { int unused; } *name |
Definition at line 338 of file btScalar.h.
#define BT_LARGE_FLOAT 1e18f |
Definition at line 205 of file btScalar.h.
#define btAssert | ( | x | ) |
Definition at line 182 of file btScalar.h.
#define btFsels | ( | a, | |||
b, | |||||
c | ) | (btScalar)btFsel(a,b,c) |
Definition at line 346 of file btScalar.h.
#define btFullAssert | ( | x | ) |
Definition at line 186 of file btScalar.h.
#define btLikely | ( | _c | ) | _c |
Definition at line 187 of file btScalar.h.
Definition at line 294 of file btScalar.h.
#define btUnlikely | ( | _c | ) | _c |
Definition at line 188 of file btScalar.h.
#define SIMD_2_PI btScalar(6.283185307179586232) |
Definition at line 287 of file btScalar.h.
#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) |
Definition at line 291 of file btScalar.h.
#define SIMD_EPSILON FLT_EPSILON |
Definition at line 301 of file btScalar.h.
#define SIMD_FORCE_INLINE inline |
Definition at line 167 of file btScalar.h.
#define SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25)) |
Definition at line 289 of file btScalar.h.
#define SIMD_INFINITY FLT_MAX |
Definition at line 302 of file btScalar.h.
#define SIMD_PI (SIMD_2_PI * btScalar(0.5)) |
Definition at line 288 of file btScalar.h.
#define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) |
Definition at line 290 of file btScalar.h.
#define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490) |
Definition at line 292 of file btScalar.h.
typedef float btScalar |
The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
Definition at line 203 of file btScalar.h.
Definition at line 264 of file btScalar.h.
Definition at line 271 of file btScalar.h.
Definition at line 278 of file btScalar.h.
Definition at line 279 of file btScalar.h.
Definition at line 305 of file btScalar.h.
Definition at line 261 of file btScalar.h.
Definition at line 336 of file btScalar.h.
Definition at line 323 of file btScalar.h.
Definition at line 280 of file btScalar.h.
Definition at line 260 of file btScalar.h.
Definition at line 283 of file btScalar.h.
Definition at line 341 of file btScalar.h.
SIMD_FORCE_INLINE bool btFuzzyZero | ( | btScalar | x | ) |
Definition at line 321 of file btScalar.h.
int btGetVersion | ( | ) | [inline] |
Definition at line 35 of file btScalar.h.
Definition at line 326 of file btScalar.h.
SIMD_FORCE_INLINE int btIsNegative | ( | btScalar | x | ) |
Definition at line 331 of file btScalar.h.
Definition at line 281 of file btScalar.h.
SIMD_FORCE_INLINE bool btMachineIsLittleEndian | ( | ) |
Definition at line 349 of file btScalar.h.
Definition at line 487 of file btScalar.h.
Definition at line 282 of file btScalar.h.
Definition at line 335 of file btScalar.h.
SIMD_FORCE_INLINE float btSelect | ( | unsigned | condition, | |
float | valueIfConditionNonZero, | |||
float | valueIfConditionZero | |||
) |
Definition at line 379 of file btScalar.h.
SIMD_FORCE_INLINE int btSelect | ( | unsigned | condition, | |
int | valueIfConditionNonZero, | |||
int | valueIfConditionZero | |||
) |
Definition at line 373 of file btScalar.h.
SIMD_FORCE_INLINE unsigned btSelect | ( | unsigned | condition, | |
unsigned | valueIfConditionNonZero, | |||
unsigned | valueIfConditionZero | |||
) |
btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBox 360 Thanks Phil Knight. See also http://www.cellperformance.com/articles/2006/04/more_techniques_for_eliminatin_1.html
Definition at line 363 of file btScalar.h.
Definition at line 262 of file btScalar.h.
Definition at line 240 of file btScalar.h.
SIMD_FORCE_INLINE void btSwap | ( | T & | a, | |
T & | b | |||
) | [inline] |
Definition at line 388 of file btScalar.h.
SIMD_FORCE_INLINE unsigned short btSwapEndian | ( | short | val | ) |
Definition at line 412 of file btScalar.h.
SIMD_FORCE_INLINE unsigned btSwapEndian | ( | int | val | ) |
Definition at line 407 of file btScalar.h.
SIMD_FORCE_INLINE unsigned short btSwapEndian | ( | unsigned short | val | ) |
Definition at line 402 of file btScalar.h.
SIMD_FORCE_INLINE unsigned btSwapEndian | ( | unsigned | val | ) |
Definition at line 397 of file btScalar.h.
SIMD_FORCE_INLINE void btSwapEndianDouble | ( | double | d, | |
unsigned char * | dst | |||
) |
Definition at line 453 of file btScalar.h.
SIMD_FORCE_INLINE unsigned int btSwapEndianFloat | ( | float | d | ) |
btSwapFloat uses using char pointers to swap the endianness
btSwapFloat/btSwapDouble will NOT return a float, because the machine might 'correct' invalid floating point values Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. so instead of returning a float/double, we return integer/long long integer
Definition at line 423 of file btScalar.h.
Definition at line 263 of file btScalar.h.
SIMD_FORCE_INLINE double btUnswapEndianDouble | ( | const unsigned char * | src | ) |
Definition at line 469 of file btScalar.h.
SIMD_FORCE_INLINE float btUnswapEndianFloat | ( | unsigned int | a | ) |
Definition at line 437 of file btScalar.h.