summaryrefslogtreecommitdiff
path: root/prism/compiler/force_inline.h
blob: e189d592d61a234129452df652044bf731bd4c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * @file compiler/force_inline.h
 */
#ifndef PRISM_COMPILER_FORCE_INLINE_H
#define PRISM_COMPILER_FORCE_INLINE_H

#include "prism/compiler/inline.h"

/**
 * Force a function to be inlined at every call site. Use sparingly — only for
 * small, hot functions where the compiler's heuristics fail to inline.
 */
#if defined(_MSC_VER)
#   define PRISM_FORCE_INLINE __forceinline
#elif defined(__GNUC__) || defined(__clang__)
#   define PRISM_FORCE_INLINE PRISM_INLINE __attribute__((always_inline))
#else
#   define PRISM_FORCE_INLINE PRISM_INLINE
#endif

#endif