4 * @brief Various utility functions that wrap compiler specific extensions
5 * @author Matthias Braun
12 * Asserts that the constant expression x is not zero at compiletime. name has
13 * to be a unique identifier.
15 * @note This uses the fact, that double case labels are not allowed.
17 #define COMPILETIME_ASSERT(x, name) \
18 static __attribute__((unused)) void compiletime_assert_##name (int h) { \
19 switch(h) { case 0: case (x): ; } \
23 * Indicates to the compiler that the value of x is very likely 1
24 * @note Only use this in speed critical code and when you are sure x is often 1
26 #define LIKELY(x) __builtin_expect((x), 1)
28 * Indicates to the compiler that it's very likely that x is 0
29 * @note Only use this in speed critical code and when you are sure x is often 0
31 #define UNLIKELY(x) __builtin_expect((x), 0)