[libcxx-commits] [libcxx] [libc++] Optimize rotate (PR #120862)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Dec 21 15:57:39 PST 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 fd784726db70a5155594c32ee839b8807fafd87d 6399aec8e1b59b0aa436cf5e08ac78cdb18bd3d3 --extensions cpp,h -- libcxx/test/benchmarks/algorithms/rotate.bench.cpp libcxx/include/__algorithm/rotate.h
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__algorithm/rotate.h b/libcxx/include/__algorithm/rotate.h
index 1755a75888..91a073c1be 100644
--- a/libcxx/include/__algorithm/rotate.h
+++ b/libcxx/include/__algorithm/rotate.h
@@ -84,9 +84,9 @@ __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIt
 
 template <class _AlgPolicy, class _Iter, class _Sent>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter __rotate_random(_Iter __first, _Iter __middle, _Sent __last) {
-  auto __left = _IterOps<_AlgPolicy>::distance(__first, __middle);
+  auto __left  = _IterOps<_AlgPolicy>::distance(__first, __middle);
   auto __right = _IterOps<_AlgPolicy>::distance(__middle, __last);
-  auto __end = __first + __right;
+  auto __end   = __first + __right;
 
   if (__left == 0 || __first == __last)
     return __first;

``````````

</details>


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


More information about the libcxx-commits mailing list