 |
VTK
9.7.1
|
Go to the documentation of this file.
70 #define VTK_ASSUME(cond) \
73 const bool c = cond; \
74 assert("Bad assumption in VTK_ASSUME: " #cond&& c); \
101 #define VTK_ASSUME_NO_ASSERT(cond) \
104 const bool c = cond; \
105 VTK_ASSUME_IMPL(c); \
110 #define VTK_HAS_BUILTIN(x) __has_builtin(x)
112 #define VTK_HAS_BUILTIN(x) 0
116 #if defined(VTK_COMPILER_MSVC) || defined(VTK_COMPILER_ICC)
117 #define VTK_ASSUME_IMPL(cond) __assume(cond)
118 #elif VTK_HAS_BUILTIN(__builtin_assume) || defined(VTK_COMPILER_CLANG)
119 #define VTK_ASSUME_IMPL(cond) __builtin_assume(cond)
120 #elif defined(VTK_COMPILER_GCC) && VTK_COMPILER_GCC_VERSION >= 130000
121 #define VTK_ASSUME_IMPL(cond) __attribute__((__assume__(cond)))
122 #elif VTK_HAS_BUILTIN(__builtin_unreachable) || defined(VTK_COMPILER_GCC)
123 #define VTK_ASSUME_IMPL(cond) \
125 __builtin_unreachable()
127 #define VTK_ASSUME_IMPL(cond) \
194 #if VTK_HAS_BUILTIN(__builtin_expect) || defined(VTK_COMPILER_GCC) || defined(VTK_COMPILER_CLANG)
195 #define VTK_EXPECT(cond, expected) __builtin_expect(cond, expected)
196 #define VTK_LIKELY(cond) VTK_EXPECT(!!(cond), 1)
197 #define VTK_UNLIKELY(cond) VTK_EXPECT(!!(cond), 0)
199 #define VTK_EXPECT(cond, expected) (cond)
200 #define VTK_LIKELY(cond) (cond)
201 #define VTK_UNLIKELY(cond) (cond)
204 #endif // vtkAssume_h