[libcxx-commits] [libcxx] [libc++][bit] Improves rotate functions. (PR #98032)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 30 10:35:14 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 2acf77f987331c05520c5bfd849326909ffce983 b7be72a32da64391d8f704ca9cf9499336e400d5 --extensions cpp,h -- libcxx/include/__bit/rotate.h libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__bit/rotate.h b/libcxx/include/__bit/rotate.h
index e7d1b6c676..90e430e9d0 100644
--- a/libcxx/include/__bit/rotate.h
+++ b/libcxx/include/__bit/rotate.h
@@ -27,7 +27,7 @@ template <class _Tp>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotl(_Tp __x, int __s) _NOEXCEPT {
   static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotl requires an unsigned integer type");
   const int __N = numeric_limits<_Tp>::digits;
-  int __r                = __s % __N;
+  int __r       = __s % __N;
 
   if (__r == 0)
     return __x;
@@ -42,7 +42,7 @@ template <class _Tp>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __x, int __s) _NOEXCEPT {
   static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type");
   const int __N = numeric_limits<_Tp>::digits;
-  int __r                = __s % __N;
+  int __r       = __s % __N;
 
   if (__r == 0)
     return __x;

``````````

</details>


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


More information about the libcxx-commits mailing list