Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
cache_line.hpp
Go to the documentation of this file.
1
// Copyright 2024, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
#
ifndef
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_HARDWARE_QUERIES_CACHE_LINE_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_HARDWARE_QUERIES_CACHE_LINE_HPP_
7
8
// IWYU pragma: private
9
// IWYU pragma: friend "arene/base/compiler_support/hardware_queries/.*"
10
11
#
include
"arene/base/stdlib_choice/cstddef.hpp"
12
13
// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
14
#
include
"arene/base/compiler_support/attributes.hpp"
15
// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
16
17
// To respect AUTOSAR C++14 constraints on C++ preprocessor usage A16-0-1
18
// We do use preprocessor only to conditionally include a file
19
20
#
if
(
defined
(
__arm__
)
&&
defined
(
__ARM_ARCH_5T__
)
)
21
22
#
include
"arene/base/compiler_support/hardware_queries/detail/cache_line_impl_32.hpp"
// IWYU pragma: export
23
24
#
else
25
// Default value to 64 bytes
26
// Should be a good fit most of the cases (x86_64, x86, aarch64)
27
28
#
include
"arene/base/compiler_support/hardware_queries/detail/cache_line_impl_64.hpp"
// IWYU pragma: export
29
30
#
endif
31
32
namespace
arene
{
33
namespace
base
{
34
35
/// @brief The minimum memory spacing required between two items to avoid false-sharing
36
///
37
/// Backport of C++17's
38
/// [std::hardware_destructive_interference_size](https://en.cppreference.com/w/cpp/thread/hardware_destructive_interference_size).
39
/// See [P0154R0](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0154r0.html) for more details
40
ARENE_MAYBE_UNUSED
constexpr
std
::
size_t
hardware_destructive_interference_size
{
41
compiler_support
::
detail
::
l1_cache_line_size
42
};
43
44
}
// namespace base
45
}
// namespace arene
46
47
#
endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPILER_SUPPORT_HARDWARE_QUERIES_CACHE_LINE_HPP_
arene::base
Definition
array_exceptions_disabled.cpp:11
arene
Copyright 2026, Toyota Motor Corporation.
Definition
array_exceptions_disabled.cpp:10
arene
base
compiler_support
hardware_queries
cache_line.hpp
Generated by
1.13.2