常用工具函数:函数+宏
utils
#define mill_cont(ptr, type, member) \
(ptr ? ((type*) (((char*) ptr) - offsetof(type, member))) : NULL)
#define MILL_CT_ASSERT_HELPER2(prefix, line) prefix##line
#define MILL_CT_ASSERT_HELPER1(prefix, line) MILL_CT_ASSERT_HELPER2(prefix, line)
#define MILL_CT_ASSERT(x) \
typedef int MILL_CT_ASSERT_HELPER1(ct_assert_,__COUNTER__) [(x) ? 1 : -1]
#if defined __GNUC__ || defined __llvm__
#define mill_fast(x) __builtin_expect(!!(x), 1)
#define mill_slow(x) __builtin_expect(!!(x), 0)
#else
#define mill_fast(x) (x)
#define mill_slow(x) (x)
#endif
#define mill_assert(x) \
do {\
if (mill_slow(!(x))) {\
fprintf(stderr, "Assert failed: " #x " (%s:%d)\n",\
__FILE__, __LINE__);\
fflush(stderr);\
abort();\
}\
} while (0)
#endif