From d65de99052d5ff08c7c4290a1f1b8e396105b8af Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 17 Apr 2025 18:44:09 +0200 Subject: Use standard library functions for llisnan and replace obvious NaN checks that don't work using /fp:fast floating point behavior under MSVC --- indra/newview/llphysicsmotion.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'indra/newview') 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, -- cgit v1.2.3