summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorAdam Moss <moss@lindenlab.com>2009-03-09 23:42:07 +0000
committerAdam Moss <moss@lindenlab.com>2009-03-09 23:42:07 +0000
commit7573288ab3ede23f97bff2f5caefcb622e7e9842 (patch)
tree1429e7d758e282e123d31a21246603d0b9814273 /indra/llmath
parent2d60d45aead0b49787fb8ad8b5a03614fe17c170 (diff)
svn merge -r113780:113785
svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/gst3-t113732 QAR-1333 linux gstreamer compatibility improvements and ADD_BUILD_TEST improvements - combo merge
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llmath.h46
1 files changed, 4 insertions, 42 deletions
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index 12fc116714..66451b1a27 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -38,6 +38,10 @@
#include "lldefs.h"
#include "llstl.h" // *TODO: Remove when LLString is gone
#include "llstring.h" // *TODO: Remove when LLString is gone
+// lltut.h uses is_approx_equal_fraction(). This was moved to its own header
+// file in llcommon so we can use lltut.h for llcommon tests without making
+// llcommon depend on llmath.
+#include "is_approx_equal_fraction.h"
// work around for Windows & older gcc non-standard function names.
#if LL_WINDOWS
@@ -142,48 +146,6 @@ inline BOOL is_approx_equal(F64 x, F64 y)
return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT);
}
-inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits)
-{
- BOOL ret = TRUE;
- F32 diff = (F32) fabs(x - y);
-
- S32 diffInt = (S32) diff;
- S32 diffFracTolerance = (S32) ((diff - (F32) diffInt) * (1 << frac_bits));
-
- // if integer portion is not equal, not enough bits were used for packing
- // so error out since either the use case is not correct OR there is
- // an issue with pack/unpack. should fail in either case.
- // for decimal portion, make sure that the delta is no more than 1
- // based on the number of bits used for packing decimal portion.
- if (diffInt != 0 || diffFracTolerance > 1)
- {
- ret = FALSE;
- }
-
- return ret;
-}
-
-inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits)
-{
- BOOL ret = TRUE;
- F64 diff = (F64) fabs(x - y);
-
- S32 diffInt = (S32) diff;
- S32 diffFracTolerance = (S32) ((diff - (F64) diffInt) * (1 << frac_bits));
-
- // if integer portion is not equal, not enough bits were used for packing
- // so error out since either the use case is not correct OR there is
- // an issue with pack/unpack. should fail in either case.
- // for decimal portion, make sure that the delta is no more than 1
- // based on the number of bits used for packing decimal portion.
- if (diffInt != 0 || diffFracTolerance > 1)
- {
- ret = FALSE;
- }
-
- return ret;
-}
-
inline S32 llabs(const S32 a)
{
return S32(std::labs(a));