[libcxx-commits] [libcxx] [libc++] Simplify std::strong_order (PR #164233)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 20 04:31:05 PDT 2025


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 origin/main HEAD --extensions h -- libcxx/include/__compare/strong_order.h --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/libcxx/include/__compare/strong_order.h b/libcxx/include/__compare/strong_order.h
index 562a231db..ba6de4464 100644
--- a/libcxx/include/__compare/strong_order.h
+++ b/libcxx/include/__compare/strong_order.h
@@ -55,10 +55,10 @@ struct __fn {
     if constexpr (numeric_limits<_Dp>::is_iec559 &&
                   (sizeof(_Dp) == sizeof(int32_t) || sizeof(_Dp) == sizeof(int64_t))) {
       using _IntT = conditional_t<sizeof(_Dp) == sizeof(int32_t), int32_t, int64_t>;
-      _IntT __rx = std::bit_cast<_IntT>(__t);
-      _IntT __ry = std::bit_cast<_IntT>(__u);
-      __rx         = (__rx < 0) ? (numeric_limits<_IntT>::min() - __rx - 1) : __rx;
-      __ry         = (__ry < 0) ? (numeric_limits<_IntT>::min() - __ry - 1) : __ry;
+      _IntT __rx  = std::bit_cast<_IntT>(__t);
+      _IntT __ry  = std::bit_cast<_IntT>(__u);
+      __rx        = (__rx < 0) ? (numeric_limits<_IntT>::min() - __rx - 1) : __rx;
+      __ry        = (__ry < 0) ? (numeric_limits<_IntT>::min() - __ry - 1) : __ry;
       return (__rx <=> __ry);
     } else if (__t < __u) {
       return strong_ordering::less;

``````````

</details>


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


More information about the libcxx-commits mailing list