From 76fde7399f95074a6e06c6412a20a5acda0857fc Mon Sep 17 00:00:00 2001
From: Andi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Date: Wed, 22 Mar 2023 09:27:59 +0000
Subject: [PATCH] Bug 1660405 - remove unused mozilla::IsFinite.
 r=sergesanspaille

Differential Revision: https://phabricator.services.mozilla.com/D173050
---
 mfbt/FloatingPoint.h             | 13 -------------
 mfbt/tests/TestFloatingPoint.cpp | 19 ++++++-------------
 2 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/mfbt/FloatingPoint.h b/mfbt/FloatingPoint.h
index 6667aecc5dc7d..51a869374f2ba 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 eb819bae0e65a..44918cd1c5572 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>()));
-- 
GitLab