diff --git a/mfbt/FloatingPoint.h b/mfbt/FloatingPoint.h index df418c8e0849..6667aecc5dc7 100644 --- a/mfbt/FloatingPoint.h +++ b/mfbt/FloatingPoint.h @@ -155,16 +155,6 @@ struct FloatingPoint final : private detail::FloatingPointTrait { "all bits accounted for"); }; -/** Determines whether a float/double is +Infinity or -Infinity. */ -template -static MOZ_ALWAYS_INLINE bool IsInfinite(T aValue) { - /* Infinities have all exponent bits set to 1 and an all-0 significand. */ - typedef FloatingPoint Traits; - typedef typename Traits::Bits Bits; - Bits bits = BitwiseCast(aValue); - return (bits & ~Traits::kSignBit) == Traits::kExponentBits; -} - /** Determines whether a float/double is not NaN or infinite. */ template static MOZ_ALWAYS_INLINE bool IsFinite(T aValue) { diff --git a/mfbt/tests/TestFloatingPoint.cpp b/mfbt/tests/TestFloatingPoint.cpp index 7e1fd9e03280..eb819bae0e65 100644 --- a/mfbt/tests/TestFloatingPoint.cpp +++ b/mfbt/tests/TestFloatingPoint.cpp @@ -15,7 +15,6 @@ using mozilla::FuzzyEqualsAdditive; using mozilla::FuzzyEqualsMultiplicative; using mozilla::IsFinite; using mozilla::IsFloat32Representable; -using mozilla::IsInfinite; using mozilla::IsNegative; using mozilla::IsNegativeZero; using mozilla::IsPositiveZero; @@ -316,12 +315,9 @@ static void TestDoublesPredicates() { A(!std::isnan(PositiveInfinity())); A(!std::isnan(NegativeInfinity())); - A(IsInfinite(PositiveInfinity())); - A(IsInfinite(NegativeInfinity())); - A(!IsInfinite(UnspecifiedNaN())); - A(!IsInfinite(0.0)); - A(!IsInfinite(-0.0)); - A(!IsInfinite(1.0)); + A(std::isinf(PositiveInfinity())); + A(std::isinf(NegativeInfinity())); + A(!std::isinf(UnspecifiedNaN())); A(!IsFinite(PositiveInfinity())); A(!IsFinite(NegativeInfinity())); @@ -415,12 +411,9 @@ static void TestFloatsPredicates() { A(!std::isnan(PositiveInfinity())); A(!std::isnan(NegativeInfinity())); - A(IsInfinite(PositiveInfinity())); - A(IsInfinite(NegativeInfinity())); - A(!IsInfinite(UnspecifiedNaN())); - A(!IsInfinite(0.0f)); - A(!IsInfinite(-0.0f)); - A(!IsInfinite(1.0f)); + A(std::isinf(PositiveInfinity())); + A(std::isinf(NegativeInfinity())); + A(!std::isinf(UnspecifiedNaN())); A(!IsFinite(PositiveInfinity())); A(!IsFinite(NegativeInfinity()));