ForceInline.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines macro to always inline a function.
6 
7 #pragma once
8 
9 #if defined(__GNUC__)
10 /// \ingroup UtilitiesGroup
11 /// Always inline a function. Only use this if you benchmarked the code.
12 #define SPECTRE_ALWAYS_INLINE __attribute__((always_inline)) inline
13 
14 /// \ingroup UtilitiesGroup
15 /// Always inline a function, but do not mark it `inline`
16 #define SPECTRE_JUST_ALWAYS_INLINE __attribute__((always_inline))
17 #else
18 /// \ingroup UtilitiesGroup
19 /// Always inline a function. Only use this if you benchmarked the code.
20 #define SPECTRE_ALWAYS_INLINE inline
21 
22 /// \ingroup UtilitiesGroup
23 /// Always inline a function, but do not mark it `inline`
24 #define SPECTRE_JUST_ALWAYS_INLINE
25 #endif