19 lines
532 B
C
19 lines
532 B
C
#pragma once
|
|
|
|
#define STR(x) #x
|
|
|
|
#if !defined(NDEBUG) && defined(USE_PRINTF)
|
|
#define assuming(expr) \
|
|
((expr) ? 0 : (fprintf(stderr, "assumption <" #expr "> failed on line %d\n", __LINE__), __builtin_trap(), 0))
|
|
#elif !defined(NDEBUG)
|
|
#define assuming(expr) \
|
|
((expr) ? 0 : (__builtin_trap(), 0))
|
|
#else
|
|
#define assuming(expr) ((expr) ? 0 : (__builtin_unreachable(), 0))
|
|
#endif
|
|
|
|
#define CACHE_LINE_SIZE 64
|
|
|
|
#define LIKELY(expr) __builtin_expect((expr), 1)
|
|
#define UNLIKELY(expr) __builtin_expect((expr), 0)
|