summaryrefslogtreecommitdiff
path: root/indra/llmath/llvector4a.inl
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-07-02 17:08:46 -0400
committerOz Linden <oz@lindenlab.com>2013-07-02 17:08:46 -0400
commit36634bf50f18038c2a343c786e8b22384a501eae (patch)
tree2baa639b76f2b578bac1ac3cc3221ff9326bd04c /indra/llmath/llvector4a.inl
parent9c8fdf5a49145f4147f50c16c4e1775386976798 (diff)
parent4f2c25979488733bcf92bc2f6ec357618c3e9632 (diff)
merge changes for latest integration changes
Diffstat (limited to 'indra/llmath/llvector4a.inl')
-rwxr-xr-xindra/llmath/llvector4a.inl20
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl
index 7c52ffef21..558fe09323 100755
--- a/indra/llmath/llvector4a.inl
+++ b/indra/llmath/llvector4a.inl
@@ -409,6 +409,26 @@ inline void LLVector4a::normalize3fast()
mQ = _mm_mul_ps( mQ, approxRsqrt );
}
+inline void LLVector4a::normalize3fast_checked(LLVector4a* d)
+{
+ if (!isFinite3())
+ {
+ *this = d ? *d : LLVector4a(0,1,0,1);
+ return;
+ }
+
+ LLVector4a lenSqrd; lenSqrd.setAllDot3( *this, *this );
+
+ if (lenSqrd.getF32ptr()[0] <= FLT_EPSILON)
+ {
+ *this = d ? *d : LLVector4a(0,1,0,1);
+ return;
+ }
+
+ const LLQuad approxRsqrt = _mm_rsqrt_ps(lenSqrd.mQ);
+ mQ = _mm_mul_ps( mQ, approxRsqrt );
+}
+
// Return true if this vector is normalized with respect to x,y,z up to tolerance
inline LLBool32 LLVector4a::isNormalized3( F32 tolerance ) const
{