1 #ifndef __LUNAIX_SPIKE_H
2 #define __LUNAIX_SPIKE_H
4 // Some helper functions. As helpful as Spike the Dragon! :)
7 #define CEIL(v, k) (((v) + (1 << (k)) - 1) >> (k))
10 #define FLOOR(v, k) ((v) >> (k))
13 #define ROUNDUP(v, k) (((v) + (k) - 1) & ~((k) - 1))
16 #define ROUNDDOWN(v, k) ((v) & ~((k) - 1))
18 inline static void spin() {
22 #ifdef __LUNAIXOS_DEBUG__
23 #define assert(cond) \
25 __assert_fail(#cond, __FILE__, __LINE__); \
28 #define assert_msg(cond, msg) \
30 __assert_fail(msg, __FILE__, __LINE__); \
32 void __assert_fail(const char* expr, const char* file, unsigned int line) __attribute__((noinline, noreturn));
34 #define assert(cond) //nothing
39 #endif /* __LUNAIX_SPIKE_H */