Loading...
Searching...
No Matches
Go to the documentation of this file.
8 #define INLINE inline __attribute__((always_inline))
12 #define CONST __attribute__((const))
16 #define PURE __attribute__((pure))
20 #define NODISCARD __attribute__((warn_unused_result))
23#if !defined STATIC_ASSERT
24 #if defined __cplusplus
25 #define STATIC_ASSERT static_assert
27 #define STATIC_ASSERT _Static_assert
36 fprintf(stderr, __VA_ARGS__); \
42 #define ASSERT(expr, ...) \
44 PANIC("assertion " #expr " failed: " __VA_ARGS__); \
48#if !defined UNREACHABLE
49 #define UNREACHABLE(...) PANIC("unreachable: " __VA_ARGS__ "\n");
53 #define LIKELY(x) __builtin_expect(!!(x), 1)
57 #define WHEN(cond, expr) ((cond) ? (expr) : true)
62 #define ASSUME(expr, ...) ASSERT(expr, __VA_ARGS__)
64 #if defined(__clang__)
65 #define ASSUME(expr, ...) __builtin_assume(expr)
66 #elif defined(__GNUC__)
68 #define ASSUME(expr, ...) \
71 __builtin_unreachable(); \
74 #define ASSUME(expr, ...) ((void)0)