diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-09-15 15:41:57 -0500 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-09-15 15:41:57 -0500 |
| commit | d1c812f1162e5fdb13c215792725b2591d7428f5 (patch) | |
| tree | 407056c45c7e9320c48fca6a3697d81a061c4ea0 /PxShared/include/foundation/unix/PxUnixIntrinsics.h | |
| parent | PhysX 3.4, APEX 1.4 patch release @22121272 (diff) | |
| download | physx-3.4-3.4.1.tar.xz physx-3.4-3.4.1.zip | |
PhysX 3.4.1, APEX 1.4.1 Release @22845541v3.4.1
Diffstat (limited to 'PxShared/include/foundation/unix/PxUnixIntrinsics.h')
| -rw-r--r-- | PxShared/include/foundation/unix/PxUnixIntrinsics.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/PxShared/include/foundation/unix/PxUnixIntrinsics.h b/PxShared/include/foundation/unix/PxUnixIntrinsics.h index 351c83c1..e076113f 100644 --- a/PxShared/include/foundation/unix/PxUnixIntrinsics.h +++ b/PxShared/include/foundation/unix/PxUnixIntrinsics.h @@ -37,11 +37,12 @@ #error "This file should only be included by Unix builds!!" #endif -#if PX_LINUX && !defined(__CUDACC__) - // Linux and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable - #ifndef isfinite - #define isfinite std::isfinite - #endif +#if (PX_LINUX || PX_ANDROID) && !defined(__CUDACC__) && !PX_EMSCRIPTEN + // Linux/android and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable + #include <cmath> + #ifndef isfinite + using std::isfinite; + #endif #endif #include <math.h> @@ -125,7 +126,10 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b) //! \brief platform-specific finiteness check (not INF or NAN) PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a) { - return !!isfinite(a); + //std::isfinite not recommended as of Feb 2017, since it doesn't work with g++/clang's floating point optimization. + union localU { PxU32 i; float f; } floatUnion; + floatUnion.f = a; + return !((floatUnion.i & 0x7fffffff) >= 0x7f800000); } //! \brief platform-specific finiteness check (not INF or NAN) |