[libc-commits] [libc] [libc][NFC] refactor fmin and fmax (PR #86718)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 26 12:25:44 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 5e6e40fee31d5db2f44d604b0362e1e819f41ba5 5af9f466e79415d183ba4845a421419b9002a530 -- libc/src/__support/FPUtil/BasicOperations.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 917b5ebc22..b93796d6cd 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -30,11 +30,11 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmin(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) 
+  if (bitx.is_nan())
     return y;
-  if (bity.is_nan()) 
+  if (bity.is_nan())
     return x;
-  if (bitx.sign() != bity.sign()) 
+  if (bitx.sign() != bity.sign())
     // To make sure that fmin(+0, -0) == -0 == fmin(-0, +0), whenever x and
     // y has different signs and both are not NaNs, we return the number
     // with negative sign.
@@ -46,11 +46,11 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmax(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) 
+  if (bitx.is_nan())
     return y;
-  if (bity.is_nan()) 
+  if (bity.is_nan())
     return x;
-  if (bitx.sign() != bity.sign()) 
+  if (bitx.sign() != bity.sign())
     // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and
     // y has different signs and both are not NaNs, we return the number
     // with positive sign.

``````````

</details>


https://github.com/llvm/llvm-project/pull/86718


More information about the libc-commits mailing list