diff --git a/mfbt/FloatingPoint.h b/mfbt/FloatingPoint.h index 6667aecc5dc7d6ecb886472a2fd2f4b3093d7312..51a869374f2bac9230649dc7aff2a18a9a2c1642 100644 --- a/mfbt/FloatingPoint.h +++ b/mfbt/FloatingPoint.h @@ -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. diff --git a/mfbt/tests/TestFloatingPoint.cpp b/mfbt/tests/TestFloatingPoint.cpp index eb819bae0e65a5eb6fb066963822a7a080e20fbf..44918cd1c5572bc9c55d0b5d25e67efb8077a8db 100644 --- a/mfbt/tests/TestFloatingPoint.cpp +++ b/mfbt/tests/TestFloatingPoint.cpp @@ -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; @@ -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>())); @@ -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>()));