File tree Expand file tree Collapse file tree
include/ipfixprobe/outputPlugin/outputStorage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include < cstddef>
4+ #include < new>
5+
36namespace ipxp ::output {
47
58template <typename Type>
@@ -22,10 +25,16 @@ class CacheAlligned {
2225 constexpr auto operator ->(this auto & self) noexcept { return &self.data ; }
2326
2427private:
25- static constexpr std::size_t EXPECTED_CACHE_LINE_SIZE = 64 ;
28+ #pragma GCC diagnostic push
29+ #pragma GCC diagnostic ignored "-Winterference-size"
30+ static constexpr std::size_t EXPECTED_CACHE_LINE_SIZE
31+ = std::hardware_destructive_interference_size;
32+ #pragma GCC diagnostic pop
33+ static constexpr std::size_t PADDING_SIZE
34+ = (sizeof (Type) < EXPECTED_CACHE_LINE_SIZE) ? (EXPECTED_CACHE_LINE_SIZE - sizeof (Type)) : 0 ;
2635
2736 alignas (EXPECTED_CACHE_LINE_SIZE) Type data;
28- // const std::array<std::byte, EXPECTED_CACHE_LINE_SIZE - sizeof(Type) > m_padding {};
37+ const std::array<std::byte, PADDING_SIZE > m_padding {};
2938};
3039
3140} // namespace ipxp::output
You can’t perform that action at this time.
0 commit comments