diff options
| author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2025-04-17 18:44:09 +0200 | 
|---|---|---|
| committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2025-04-17 18:44:09 +0200 | 
| commit | d65de99052d5ff08c7c4290a1f1b8e396105b8af (patch) | |
| tree | 408a694dffae3592fd873dee8de789a163907283 /indra | |
| parent | 293462d8ff6dcb00ec501d026a6589d869a2f846 (diff) | |
Use standard library functions for llisnan and replace obvious NaN checks that don't work using /fp:fast floating point behavior under MSVC
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llappearance/llpolymorph.cpp | 8 | ||||
| -rw-r--r-- | indra/llmath/llmath.h | 14 | ||||
| -rw-r--r-- | indra/newview/llphysicsmotion.cpp | 21 | 
3 files changed, 16 insertions, 27 deletions
| diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 8df8a9726f..5ee6649164 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -550,12 +550,12 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )      mLastSex = avatar_sex; -    // Check for NaN condition (NaN is detected if a variable doesn't equal itself. -    if (mCurWeight != mCurWeight) +    // Check for NaN condition +    if (llisnan(mCurWeight))      { -        mCurWeight = 0.0; +        mCurWeight = 0.f;      } -    if (mLastWeight != mLastWeight) +    if (llisnan(mLastWeight))      {          mLastWeight = mCurWeight+.001f;      } diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index fa315291a3..c0f5b3dbf3 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -39,18 +39,8 @@  // llcommon depend on llmath.  #include "is_approx_equal_fraction.h" -// work around for Windows & older gcc non-standard function names. -#if LL_WINDOWS -#include <float.h> -#define llisnan(val)    _isnan(val) -#define llfinite(val)   _finite(val) -#elif (LL_LINUX && __GNUC__ <= 2) -#define llisnan(val)    isnan(val) -#define llfinite(val)   isfinite(val) -#else -#define llisnan(val)    std::isnan(val) -#define llfinite(val)   std::isfinite(val) -#endif +#define llisnan(val)  std::isnan(val) +#define llfinite(val) std::isfinite(val)  // Single Precision Floating Point Routines  // (There used to be more defined here, but they appeared to be redundant and diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index 86291708b0..e5c84728fe 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -646,18 +646,17 @@ bool LLPhysicsMotion::onUpdate(F32 time)              velocity_new_local = 0;          } -        // Check for NaN values.  A NaN value is detected if the variables doesn't equal itself. -        // If NaN, then reset everything. -        if ((mPosition_local != mPosition_local) || -            (mVelocity_local != mVelocity_local) || -            (position_new_local != position_new_local)) +        // Check for NaN values. If NaN, then reset everything. +        if (llisnan(mPosition_local) || +            llisnan(mVelocity_local) || +            llisnan(position_new_local))          { -            position_new_local = 0; -            mVelocity_local = 0; -            mVelocityJoint_local = 0; -            mAccelerationJoint_local = 0; -            mPosition_local = 0; -            mPosition_world = LLVector3(0,0,0); +            position_new_local = 0.f; +            mVelocity_local = 0.f; +            mVelocityJoint_local = 0.f; +            mAccelerationJoint_local = 0.f; +            mPosition_local = 0.f; +            mPosition_world = LLVector3(0.f,0.f,0.f);          }          const F32 position_new_local_clamped = llclamp(position_new_local, | 
