Skip to content

Commit

Permalink
Common/Compiler: Introduced XR_ASSUME() macro.
Browse files Browse the repository at this point in the history
There is the only one "assume" usage yet, but the macro is useful for
future optimization.
  • Loading branch information
Kaffeine committed May 27, 2016
1 parent da996ce commit 817f2a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Common/Compiler.inl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
#define XR_IMPORT __declspec(dllimport)
#endif

#if defined(__GNUC__)
#define XR_ASSUME(expr) if (expr){} else __builtin_unreachable()
#elif defined(_MSC_VER)
#define XR_ASSUME(expr) __assume(expr)
#endif

#if defined(__GNUC__)
#define NO_INLINE __attribute__((noinline))
#define FORCE_INLINE __attribute__((always_inline)) inline
Expand Down

0 comments on commit 817f2a7

Please sign in to comment.