|
libcute 0.1
|

Go to the source code of this file.
Macros | |
| #define | CU_IF_NULL(expr) if ((expr) == NULL) |
| #define | CU_IF_NOT_NULL(expr) if ((expr) != NULL) |
| #define | CU_DIE(msg) cu_panic_handler("Fatal error: %s", msg) |
| #define | CU_ALIGN_UP(x, align) (((x) + (align) - 1) & ~((align) - 1)) |
| #define | CU_UNUSED(expr) (void)(expr) |
| #define | CU_ARRAY_LEN(arr) (sizeof(arr) / sizeof((arr)[0])) |
| #define | CU_BIT(x) (1u << (x)) |
| #define | CU_CONCAT_(a, b) a##b |
| #define | CU_CONCAT(a, b) CU_CONCAT_(a, b) |
| #define | CU_MIN(a, b) ((a) < (b) ? (a) : (b)) |
| #define | CU_MAX(a, b) ((a) > (b) ? (a) : (b)) |
| #define | CU_PLAT_WINDOWS 0 |
| #define | CU_PLAT_MACOS 0 |
| #define | CU_PLAT_LINUX 0 |
| #define | CU_PLAT_WASM 0 |
| #define | CU_PLAT_BSD 0 |
| #define | CU_PLAT_POSIX 0 |
| #define | CU_COMPILER_CLANG 0 |
| #define | CU_COMPILER_GCC 0 |
| #define | CU_COMPILER_MSVC 0 |
| #define | CU_COMPILER_TCC 0 |
| #define | CU_COMPILER_INTEL 0 |
| #define | CU_COMPILER_LLVM 0 |
| #define | UNREACHABLE(msg) cu_panic_handler("Unreachable code reached: %s", msg) |
| #define | TODO(msg) cu_panic_handler("TODO: %s", msg) |
| #define | CU_AS(expr, T) (T)(expr) |
Common utility macros.
| #define CU_ALIGN_UP | ( | x, | |
| align | |||
| ) | (((x) + (align) - 1) & ~((align) - 1)) |
Round x up to the nearest multiple of align.
| #define CU_ARRAY_LEN | ( | arr | ) | (sizeof(arr) / sizeof((arr)[0])) |
Array element count.
| #define CU_BIT | ( | x | ) | (1u << (x)) |
Create a bit mask with bit x set.
| #define CU_CONCAT_ | ( | a, | |
| b | |||
| ) | a##b |
Concatenate two tokens after expanding them.
| #define CU_DIE | ( | msg | ) | cu_panic_handler("Fatal error: %s", msg) |
Abort the program with an error message.
| #define CU_IF_NOT_NULL | ( | expr | ) | if ((expr) != NULL) |
Execute the following block if expr is not NULL.
| #define CU_IF_NULL | ( | expr | ) | if ((expr) == NULL) |
Execute the following block if expr is NULL.
| #define CU_PLAT_WINDOWS 0 |
Platform detection macros
| #define CU_UNUSED | ( | expr | ) | (void)(expr) |
Silence unused variable warnings.