]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/util.h
Use dragonnet
[dragonblocks_alpha.git] / src / util.h
1 #ifndef _UTIL_H_
2 #define _UTIL_H_
3
4 #define ever (;;)                                                            // infinite for loop with style
5 #define INBRACES(str) (str) ? "(" : "", (str) ? (str) : "", (str) ? ")" : "" // wrapper for printf to optionally add a message in braces if message is not NULL
6 #define CMPBOUNDS(x) ((x) == 0 ? 0 : (x) > 0 ? 1 : -1)                       // resolves to 1 if x > 0, 0 if x == 0 and -1 if x < 0
7 #define fallthrough __attribute__ ((fallthrough))                            // prevent compiler warning about implicit fallthrough with style
8 #define unused __attribute__ ((unused))
9 #define U32(x) (((u32) 1 << 31) + (x))
10
11 char *format_string(const char *format, ...);
12
13 #endif