 |
VTK
9.5.20251008
|
Go to the documentation of this file.
30#define VTK_ASSUME(cond) \
33 const bool c = cond; \
34 assert("Bad assumption in VTK_ASSUME: " #cond&& c); \
39#define VTK_ASSUME_NO_ASSERT(cond) \
42 const bool c = cond; \
48#define VTK_HAS_BUILTIN(x) __has_builtin(x)
50#define VTK_HAS_BUILTIN(x) 0
54#if defined(VTK_COMPILER_MSVC) || defined(VTK_COMPILER_ICC)
55#define VTK_ASSUME_IMPL(cond) __assume(cond)
56#elif VTK_HAS_BUILTIN(__builtin_assume) || defined(VTK_COMPILER_CLANG)
57#define VTK_ASSUME_IMPL(cond) __builtin_assume(cond)
58#elif defined(VTK_COMPILER_GCC) && VTK_COMPILER_GCC_VERSION >= 130000
59#define VTK_ASSUME_IMPL(cond) __attribute__((__assume__(cond)))
60#elif VTK_HAS_BUILTIN(__builtin_unreachable) || defined(VTK_COMPILER_GCC)
61#define VTK_ASSUME_IMPL(cond) \
63 __builtin_unreachable()
65#define VTK_ASSUME_IMPL(cond) \
72#if VTK_HAS_BUILTIN(__builtin_expect) || defined(VTK_COMPILER_GCC) || defined(VTK_COMPILER_CLANG)
73#define VTK_EXPECT(cond, expected) __builtin_expect(cond, expected)
74#define VTK_LIKELY(cond) VTK_EXPECT(!!(cond), 1)
75#define VTK_UNLIKELY(cond) VTK_EXPECT(!!(cond), 0)
77#define VTK_EXPECT(cond, expected) (cond)
78#define VTK_LIKELY(cond) (cond)
79#define VTK_UNLIKELY(cond) (cond)