diff options
| author | Marijn Tamis <[email protected]> | 2017-10-20 14:30:56 +0200 |
|---|---|---|
| committer | Marijn Tamis <[email protected]> | 2017-10-20 14:36:12 +0200 |
| commit | fabb251458f4a2d6d4f87dd36038fac2774b378c (patch) | |
| tree | 68a4a0ecd940dc949e0477d521d8c159968cfcd5 /PxShared/include/foundation/unix/PxUnixIntrinsics.h | |
| parent | NvCloth 1.1.2 Release. (22576033) (diff) | |
| download | nvcloth-fabb251458f4a2d6d4f87dd36038fac2774b378c.tar.xz nvcloth-fabb251458f4a2d6d4f87dd36038fac2774b378c.zip | |
NvCloth 1.1.3 Release. (23014067)v1.1.3
Diffstat (limited to 'PxShared/include/foundation/unix/PxUnixIntrinsics.h')
| -rw-r--r-- | PxShared/include/foundation/unix/PxUnixIntrinsics.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/PxShared/include/foundation/unix/PxUnixIntrinsics.h b/PxShared/include/foundation/unix/PxUnixIntrinsics.h index 351c83c..5f492bc 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) @@ -153,7 +157,7 @@ PX_FORCE_INLINE void* memSet(void* dest, int32_t c, uint32_t count) /*! Copies \c count bytes from \c src to \c dst. User memMove if regions overlap. */ -PX_FORCE_INLINE void* memCopy(void* PX_RESTRICT dest, const void* PX_RESTRICT src, uint32_t count) +PX_FORCE_INLINE void* memCopy(void* dest, const void* src, uint32_t count) { return memcpy(dest, src, count); } |