[libcxx-commits] [libcxx] [libc++] Optimize to_chars integral overloads (PR #210659)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 20 01:12:04 PDT 2026
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/__charconv/to_chars_integral.h libcxx/test/support/charconv_test_helpers.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/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h
index 25d2cfe82..4a7ba0fef 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -152,13 +152,13 @@ struct _LIBCPP_HIDDEN __integral<2> {
__value <<= __shift;
// Move the value into a vector and chop it up into its constituent bytes
- auto __chopped = __simd_vector<char, sizeof(_Tp)>(__simd_vector<_Tp, 1>(__value));
+ auto __chopped = __simd_vector<char, sizeof(_Tp)>(__simd_vector<_Tp, 1>(__value));
// Duplicate values so we can extract the appropriate bits in multiple positions
auto __characters = __itoa::__duplicate_vector_entries<8>(__chopped);
// This is marked `always_inline` because it interacts with simd vectors
- auto __shifts = []<size_t... _Indices> [[__gnu__::__always_inline__]] (index_sequence<_Indices...>) {
+ auto __shifts = []<size_t... _Indices> [[__gnu__::__always_inline__]] (index_sequence<_Indices...>) {
return __simd_vector<char, 8 * sizeof(_Tp)>{(7 - _Indices % 8)...};
}(make_index_sequence<8 * sizeof(_Tp)>());
@@ -254,13 +254,13 @@ struct _LIBCPP_HIDDEN __integral<16> {
__value <<= __shift;
// Move the value into a vector and chop it up into its constituent bytes
- auto __chopped = __simd_vector<char, sizeof(_Tp)>(__simd_vector<_Tp, 1>(__value));
+ auto __chopped = __simd_vector<char, sizeof(_Tp)>(__simd_vector<_Tp, 1>(__value));
// Duplicate values so we can extract the appropriate bits in multiple positions
auto __characters = __itoa::__duplicate_vector_entries<2>(__chopped);
// This is marked `always_inline` because it interacts with simd vectors
- auto __shifts = []<size_t... _Indices> [[__gnu__::__always_inline__]] (index_sequence<_Indices...>) {
+ auto __shifts = []<size_t... _Indices> [[__gnu__::__always_inline__]] (index_sequence<_Indices...>) {
return __simd_vector<char, 2 * sizeof(_Tp)>{(_Indices % 2 == 0 ? 4 : 0)...};
}(make_index_sequence<2 * sizeof(_Tp)>());
``````````
</details>
https://github.com/llvm/llvm-project/pull/210659
More information about the libcxx-commits
mailing list