[libcxx-commits] [libcxx] [libcxx] Align allocation to match `__set_long_cap` and `__get_long_cap` (PR #90292)
Vitaly Buka via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 30 14:39:34 PDT 2024
================
@@ -1959,10 +1960,10 @@ private:
if (__s < __min_cap) {
return static_cast<size_type>(__min_cap) - 1;
}
- const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 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 += 2;
----------------
vitalybuka wrote:
works with ASSERT, and likely will work with asan
Should `__guess += 2` be replaced with `__guess += __endian_factor` if we want to keep __endian_factor alignment?
https://github.com/llvm/llvm-project/pull/90292
More information about the libcxx-commits
mailing list