diff options
author | babenko <babenko@yandex-team.com> | 2022-11-03 12:06:56 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2022-11-03 12:06:56 +0300 |
commit | dbf2ffa6163e1f1e041be4ce1a77520d9f1cd011 (patch) | |
tree | 7046b008920f063fd02db9f99d0c360c6ce37033 | |
parent | cd02abf724a4118ec07afabfe59ccc57aa24bb94 (diff) | |
download | ydb-dbf2ffa6163e1f1e041be4ce1a77520d9f1cd011.tar.gz |
Properly use std::max_align_t
-rw-r--r-- | library/cpp/yt/memory/new-inl.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/cpp/yt/memory/new-inl.h b/library/cpp/yt/memory/new-inl.h index ea2a9bca04..978fa01aeb 100644 --- a/library/cpp/yt/memory/new-inl.h +++ b/library/cpp/yt/memory/new-inl.h @@ -175,7 +175,7 @@ Y_FORCE_INLINE TIntrusivePtr<T> SafeConstruct(void* ptr, As&&... args) template <size_t Size, size_t Alignment> void* AllocateConstSizeAligned() { - if (Alignment <= sizeof(std::max_align_t)) { + if (Alignment <= alignof(std::max_align_t)) { return ::malloc(Size); } else { return ::aligned_malloc(Size, Alignment); @@ -219,7 +219,7 @@ Y_FORCE_INLINE TIntrusivePtr<T> NewWithExtraSpace( auto totalSize = NYT::NDetail::TConstructHelper<T>::Size + extraSpaceSize; void* ptr = nullptr; - if (NYT::NDetail::TConstructHelper<T>::Alignment <= sizeof(std::max_align_t)) { + if (NYT::NDetail::TConstructHelper<T>::Alignment <= alignof(std::max_align_t)) { ptr = ::malloc(totalSize); } else { ptr = ::aligned_malloc(totalSize, NYT::NDetail::TConstructHelper<T>::Alignment); |