Use standard library functions for llisnan and replace obvious NaN checks that don't work using /fp:fast floating point behavior under MSVC
parent
293462d8ff
commit
d65de99052
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue