#ifndef BT_SCALAR_H
#define BT_SCALAR_H
#ifdef BT_MANAGED_CODE
#pragma unmanaged
#endif
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#define BT_BULLET_VERSION …
namespace VHACD {
inline int32_t btGetVersion()
{ … }
};
#if defined(DEBUG) || defined(_DEBUG)
#define BT_DEBUG
#endif
#ifdef _WIN32
#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined(_MSC_VER) && _MSC_VER < 1300)
#define SIMD_FORCE_INLINE …
#define ATTRIBUTE_ALIGNED16 …
#define ATTRIBUTE_ALIGNED64 …
#define ATTRIBUTE_ALIGNED128 …
#else
#pragma warning(disable : 4324)
#define SIMD_FORCE_INLINE …
#define ATTRIBUTE_ALIGNED16 …
#define ATTRIBUTE_ALIGNED64 …
#define ATTRIBUTE_ALIGNED128 …
#ifdef _XBOX
#define BT_USE_VMX128
#include <ppcintrinsics.h>
#define BT_HAVE_NATIVE_FSEL
#define btFsel …
#else
#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION)) && (!defined(_M_ARM)) && (!defined(_M_ARM64))
#define BT_USE_SSE
#include <emmintrin.h>
#endif
#endif
#endif
#include <assert.h>
#ifdef BT_DEBUG
#define btAssert …
#else
#define btAssert …
#endif
#define btFullAssert …
#define btLikely …
#define btUnlikely …
#else
#if defined(__CELLOS_LV2__)
#define SIMD_FORCE_INLINE …
#define ATTRIBUTE_ALIGNED16 …
#define ATTRIBUTE_ALIGNED64 …
#define ATTRIBUTE_ALIGNED128 …
#ifndef assert
#include <assert.h>
#endif
#ifdef BT_DEBUG
#ifdef __SPU__
#include <spu_printf.h>
#define printf …
#define btAssert …
#else
#define btAssert …
#endif
#else
#define btAssert …
#endif
#define btFullAssert …
#define btLikely …
#define btUnlikely …
#else
#ifdef USE_LIBSPE2
#define SIMD_FORCE_INLINE …
#define ATTRIBUTE_ALIGNED16 …
#define ATTRIBUTE_ALIGNED64 …
#define ATTRIBUTE_ALIGNED128 …
#ifndef assert
#include <assert.h>
#endif
#ifdef BT_DEBUG
#define btAssert …
#else
#define btAssert …
#endif
#define btFullAssert …
#define btLikely …
#define btUnlikely …
#else
#if (defined(__APPLE__) && defined(__i386__) && (!defined(BT_USE_DOUBLE_PRECISION)))
#define BT_USE_SSE
#include <emmintrin.h>
#define SIMD_FORCE_INLINE …
#define ATTRIBUTE_ALIGNED16 …
#define ATTRIBUTE_ALIGNED64 …
#define ATTRIBUTE_ALIGNED128 …
#ifndef assert
#include <assert.h>
#endif
#if defined(DEBUG) || defined(_DEBUG)
#define btAssert …
#else
#define btAssert …
#endif
#define btFullAssert …
#define btLikely …
#define btUnlikely …
#else
#define SIMD_FORCE_INLINE …
#define ATTRIBUTE_ALIGNED16(a) …
#define ATTRIBUTE_ALIGNED64(a) …
#define ATTRIBUTE_ALIGNED128(a) …
#ifndef assert
#include <assert.h>
#endif
#if defined(DEBUG) || defined(_DEBUG)
#define btAssert …
#else
#define btAssert(x) …
#endif
#define btFullAssert(x) …
#define btLikely(_c) …
#define btUnlikely(_c) …
#endif
#endif
#endif
#endif
namespace VHACD {
#if defined(BT_USE_DOUBLE_PRECISION)
typedef double btScalar;
#define BT_LARGE_FLOAT …
#else
btScalar;
#define BT_LARGE_FLOAT …
#endif
#define BT_DECLARE_ALIGNED_ALLOCATOR() …
#if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS)
SIMD_FORCE_INLINE btScalar btSqrt(btScalar x)
{
return sqrt(x);
}
SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); }
SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); }
SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); }
SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); }
SIMD_FORCE_INLINE btScalar btAcos(btScalar x)
{
if (x < btScalar(-1))
x = btScalar(-1);
if (x > btScalar(1))
x = btScalar(1);
return acos(x);
}
SIMD_FORCE_INLINE btScalar btAsin(btScalar x)
{
if (x < btScalar(-1))
x = btScalar(-1);
if (x > btScalar(1))
x = btScalar(1);
return asin(x);
}
SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); }
SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x, y); }
SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); }
SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); }
SIMD_FORCE_INLINE btScalar btPow(btScalar x, btScalar y) { return pow(x, y); }
SIMD_FORCE_INLINE btScalar btFmod(btScalar x, btScalar y) { return fmod(x, y); }
#else
SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
{ … }
SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { … }
SIMD_FORCE_INLINE btScalar btCos(btScalar x) { … }
SIMD_FORCE_INLINE btScalar btSin(btScalar x) { … }
SIMD_FORCE_INLINE btScalar btTan(btScalar x) { … }
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 btExp(btScalar x) { … }
SIMD_FORCE_INLINE btScalar btLog(btScalar x) { … }
SIMD_FORCE_INLINE btScalar btPow(btScalar x, btScalar y) { … }
SIMD_FORCE_INLINE btScalar btFmod(btScalar x, btScalar y) { … }
#endif
#define SIMD_2_PI …
#define SIMD_PI …
#define SIMD_HALF_PI …
#define SIMD_RADS_PER_DEG …
#define SIMD_DEGS_PER_RAD …
#define SIMDSQRT12 …
#define btRecipSqrt(x) …
#ifdef BT_USE_DOUBLE_PRECISION
#define SIMD_EPSILON …
#define SIMD_INFINITY …
#else
#define SIMD_EPSILON …
#define SIMD_INFINITY …
#endif
SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x)
{ … }
SIMD_FORCE_INLINE bool btFuzzyZero(btScalar x) { … }
SIMD_FORCE_INLINE bool btEqual(btScalar a, btScalar eps)
{ … }
SIMD_FORCE_INLINE bool btGreaterEqual(btScalar a, btScalar eps)
{ … }
SIMD_FORCE_INLINE int32_t btIsNegative(btScalar x)
{ … }
SIMD_FORCE_INLINE btScalar btRadians(btScalar x) { … }
SIMD_FORCE_INLINE btScalar btDegrees(btScalar x) { … }
#define BT_DECLARE_HANDLE(name) …
#ifndef btFsel
SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c)
{ … }
#endif
#define btFsels(a, b, c) …
SIMD_FORCE_INLINE bool btMachineIsLittleEndian()
{ … }
SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
{ … }
SIMD_FORCE_INLINE int32_t btSelect(unsigned condition, int32_t valueIfConditionNonZero, int32_t valueIfConditionZero)
{ … }
SIMD_FORCE_INLINE float btSelect(unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero)
{ … }
template <typename T>
SIMD_FORCE_INLINE void btSwap(T& a, T& b)
{ … }
SIMD_FORCE_INLINE unsigned btSwapEndian(unsigned val)
{ … }
SIMD_FORCE_INLINE unsigned short btSwapEndian(unsigned short val)
{ … }
SIMD_FORCE_INLINE unsigned btSwapEndian(int32_t val)
{ … }
SIMD_FORCE_INLINE unsigned short btSwapEndian(short val)
{ … }
SIMD_FORCE_INLINE uint32_t btSwapEndianFloat(float d)
{ … }
SIMD_FORCE_INLINE float btUnswapEndianFloat(uint32_t a)
{ … }
SIMD_FORCE_INLINE void btSwapEndianDouble(double d, unsigned char* dst)
{ … }
SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char* src)
{ … }
SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians)
{ … }
struct btTypedObject { … };
template <typename T>
T *btAlignPointer(T *unalignedPtr, size_t alignment)
{ … }
};
#endif