Loading mfbt/FloatingPoint.h +0 −13 Original line number Diff line number Diff line Loading @@ -155,19 +155,6 @@ struct FloatingPoint final : private detail::FloatingPointTrait<T> { "all bits accounted for"); }; /** Determines whether a float/double is not NaN or infinite. */ template <typename T> static MOZ_ALWAYS_INLINE bool IsFinite(T aValue) { /* * NaN and Infinities are the only non-finite floats/doubles, and both have * all exponent bits set to 1. */ typedef FloatingPoint<T> Traits; typedef typename Traits::Bits Bits; Bits bits = BitwiseCast<Bits>(aValue); return (bits & Traits::kExponentBits) != Traits::kExponentBits; } /** * Determines whether a float/double is negative or -0. It is an error * to call this method on a float/double which is NaN. Loading mfbt/tests/TestFloatingPoint.cpp +6 −13 Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ using mozilla::ExponentComponent; using mozilla::FloatingPoint; using mozilla::FuzzyEqualsAdditive; using mozilla::FuzzyEqualsMultiplicative; using mozilla::IsFinite; using mozilla::IsFloat32Representable; using mozilla::IsNegative; using mozilla::IsNegativeZero; Loading Loading @@ -319,12 +318,9 @@ static void TestDoublesPredicates() { A(std::isinf(NegativeInfinity<double>())); A(!std::isinf(UnspecifiedNaN<double>())); A(!IsFinite(PositiveInfinity<double>())); A(!IsFinite(NegativeInfinity<double>())); A(!IsFinite(UnspecifiedNaN<double>())); A(IsFinite(0.0)); A(IsFinite(-0.0)); A(IsFinite(1.0)); A(!std::isfinite(PositiveInfinity<double>())); A(!std::isfinite(NegativeInfinity<double>())); A(!std::isfinite(UnspecifiedNaN<double>())); A(!IsNegative(PositiveInfinity<double>())); A(IsNegative(NegativeInfinity<double>())); Loading Loading @@ -415,12 +411,9 @@ static void TestFloatsPredicates() { A(std::isinf(NegativeInfinity<float>())); A(!std::isinf(UnspecifiedNaN<float>())); A(!IsFinite(PositiveInfinity<float>())); A(!IsFinite(NegativeInfinity<float>())); A(!IsFinite(UnspecifiedNaN<float>())); A(IsFinite(0.0f)); A(IsFinite(-0.0f)); A(IsFinite(1.0f)); A(!std::isfinite(PositiveInfinity<float>())); A(!std::isfinite(NegativeInfinity<float>())); A(!std::isfinite(UnspecifiedNaN<float>())); A(!IsNegative(PositiveInfinity<float>())); A(IsNegative(NegativeInfinity<float>())); Loading Loading
mfbt/FloatingPoint.h +0 −13 Original line number Diff line number Diff line Loading @@ -155,19 +155,6 @@ struct FloatingPoint final : private detail::FloatingPointTrait<T> { "all bits accounted for"); }; /** Determines whether a float/double is not NaN or infinite. */ template <typename T> static MOZ_ALWAYS_INLINE bool IsFinite(T aValue) { /* * NaN and Infinities are the only non-finite floats/doubles, and both have * all exponent bits set to 1. */ typedef FloatingPoint<T> Traits; typedef typename Traits::Bits Bits; Bits bits = BitwiseCast<Bits>(aValue); return (bits & Traits::kExponentBits) != Traits::kExponentBits; } /** * Determines whether a float/double is negative or -0. It is an error * to call this method on a float/double which is NaN. Loading
mfbt/tests/TestFloatingPoint.cpp +6 −13 Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ using mozilla::ExponentComponent; using mozilla::FloatingPoint; using mozilla::FuzzyEqualsAdditive; using mozilla::FuzzyEqualsMultiplicative; using mozilla::IsFinite; using mozilla::IsFloat32Representable; using mozilla::IsNegative; using mozilla::IsNegativeZero; Loading Loading @@ -319,12 +318,9 @@ static void TestDoublesPredicates() { A(std::isinf(NegativeInfinity<double>())); A(!std::isinf(UnspecifiedNaN<double>())); A(!IsFinite(PositiveInfinity<double>())); A(!IsFinite(NegativeInfinity<double>())); A(!IsFinite(UnspecifiedNaN<double>())); A(IsFinite(0.0)); A(IsFinite(-0.0)); A(IsFinite(1.0)); A(!std::isfinite(PositiveInfinity<double>())); A(!std::isfinite(NegativeInfinity<double>())); A(!std::isfinite(UnspecifiedNaN<double>())); A(!IsNegative(PositiveInfinity<double>())); A(IsNegative(NegativeInfinity<double>())); Loading Loading @@ -415,12 +411,9 @@ static void TestFloatsPredicates() { A(std::isinf(NegativeInfinity<float>())); A(!std::isinf(UnspecifiedNaN<float>())); A(!IsFinite(PositiveInfinity<float>())); A(!IsFinite(NegativeInfinity<float>())); A(!IsFinite(UnspecifiedNaN<float>())); A(IsFinite(0.0f)); A(IsFinite(-0.0f)); A(IsFinite(1.0f)); A(!std::isfinite(PositiveInfinity<float>())); A(!std::isfinite(NegativeInfinity<float>())); A(!std::isfinite(UnspecifiedNaN<float>())); A(!IsNegative(PositiveInfinity<float>())); A(IsNegative(NegativeInfinity<float>())); Loading