summaryrefslogtreecommitdiff
path: root/indra/llmath/llmath.h
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-07-23 18:47:16 -0700
committerRichard Linden <none@none>2013-07-23 18:47:16 -0700
commit50c472c24216ad0c3890cb8bb9cf638e75642f0c (patch)
tree63e03d8f53db589738028d0774bc189f84cc0a29 /indra/llmath/llmath.h
parentd9b8544fd437aaed14091c6642fb7da19e146b34 (diff)
renamed mVarianceSum to mSumOfSquares to be more clear
fixed normalization assertions to work with megaprims added is_zero() utility function fixed unit declarations to be more clear fixed texture cache hit rate always being 0
Diffstat (limited to 'indra/llmath/llmath.h')
-rwxr-xr-xindra/llmath/llmath.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index cad2461e9c..eeb5cd3ee6 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -113,6 +113,12 @@ inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f <
// WARNING: Infinity is comparable with F32_MAX and negative
// infinity is comparable with F32_MIN
+// handles negative and positive zeros
+inline bool is_zero(F32 x)
+{
+ return (*(U32*)(&x) & 0x7fffffff) == 0;
+}
+
inline bool is_approx_equal(F32 x, F32 y)
{
const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;