From d1c812f1162e5fdb13c215792725b2591d7428f5 Mon Sep 17 00:00:00 2001 From: Sheikh Dawood Abdul Ajees Date: Fri, 15 Sep 2017 15:41:57 -0500 Subject: PhysX 3.4.1, APEX 1.4.1 Release @22845541 --- PxShared/include/foundation/unix/PxUnixIntrinsics.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'PxShared/include/foundation/unix') 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 + #ifndef isfinite + using std::isfinite; + #endif #endif #include @@ -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) -- cgit v1.2.3