[llvm-branch-commits] [libcxx] release/18.x: [libcxx] Align `__recommend() + 1` by __endian_factor (#90292) (PR #95264)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 12 08:43:53 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport 382f70a877f0 d129ea8d2fa3
Requested by: @<!-- -->DimitryAndric
---
Full diff: https://github.com/llvm/llvm-project/pull/95264.diff
1 Files Affected:
- (modified) libcxx/include/string (+3-3)
``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index ba169c3dbfc9e..56e2ef09947f4 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1943,10 +1943,10 @@ private:
if (__s < __min_cap) {
return static_cast<size_type>(__min_cap) - 1;
}
- size_type __guess =
- __align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1;
+ const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : __endian_factor;
+ size_type __guess = __align_it<__boundary>(__s + 1) - 1;
if (__guess == __min_cap)
- ++__guess;
+ __guess += __endian_factor;
return __guess;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/95264
More information about the llvm-branch-commits
mailing list