diff --git a/src/Common/Compiler.inl b/src/Common/Compiler.inl index 522e86885a5..4e2cd9aa080 100644 --- a/src/Common/Compiler.inl +++ b/src/Common/Compiler.inl @@ -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