Loading...
Searching...
No Matches
Go to the documentation of this file.
11#if !defined PLACEHOLDERS
12 #if defined DC_PANIC_HEADER
13 #include DC_PANIC_HEADER
17#if !defined DC_STATIC_ASSERT
18 #if defined __cplusplus
19 #define DC_STATIC_ASSERT static_assert
21 #define DC_STATIC_ASSERT _Static_assert
28 #define DC_PANIC(...) \
30 fprintf(stderr, __VA_ARGS__); \
36 #define DC_ASSERT(expr, ...) \
38 DC_PANIC("assertion " #expr " failed: " __VA_ARGS__); \
42#if !defined DC_UNREACHABLE
43 #define DC_UNREACHABLE(...) DC_PANIC("unreachable: " __VA_ARGS__ "\n");
47 #define DC_LIKELY(x) __builtin_expect(!!(x), 1)
51 #define DC_WHEN(cond, expr) ((cond) ? (expr) : true)
56 #define DC_ASSUME(expr, ...) DC_ASSERT(expr, __VA_ARGS__)
58 #if defined(__clang__)
59 #define DC_ASSUME(expr, ...) __builtin_assume(expr)
60 #elif defined(__GNUC__)
62 #define DC_ASSUME(expr, ...) \
65 __builtin_unreachable(); \
68 #define DC_ASSUME(expr, ...) ((void)0)