NcEngine
New.h
Go to the documentation of this file.
1
5#pragma once
6
7#include "Platform.h"
8
9#include <new>
10
11#ifdef __cpp_lib_hardware_interference_size
12 #ifdef NC_COMPILER_GCC
13 // GCC issues diagnostics on any ODR use of constants in 'std' namespace b/c they are tuneable values.
14 #define NC_DESTRUCTIVE_INTERFERENCE_SIZE __GCC_DESTRUCTIVE_SIZE
15 #define NC_CONSTRUCTIVE_INTERFERENCE_SIZE __GCC_CONSTRUCTIVE_SIZE
16 #else
17 #define NC_DESTRUCTIVE_INTERFERENCE_SIZE std::hardware_destructive_interference_size
18 #define NC_CONSTRUCTIVE_INTERFERENCE_SIZE std::hardware_constructive_interference_size
19 #endif
20#else
21 #define NC_DESTRUCTIVE_INTERFERENCE_SIZE 64
22 #define NC_CONSTRUCTIVE_INTERFERENCE_SIZE 64
23#endif
24
25namespace nc
26{
27inline constexpr auto hardware_destructive_interference_size = NC_DESTRUCTIVE_INTERFERENCE_SIZE;
28inline constexpr auto hardware_constructive_interference_size = NC_CONSTRUCTIVE_INTERFERENCE_SIZE;
29} // namespace nc