X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flib.h;h=a36b5be6341537c7e41e168293a0391f54847dc5;hb=3cf2b0aaf15a2076c18de7e684703c175ed05d4e;hp=923afca5622d349a258f82b08b359e6c0a3171b6;hpb=7093c3275e649ae60935fe07bb6b44398b3ca4c0;p=libucw.git diff --git a/lib/lib.h b/lib/lib.h index 923afca5..a36b5be6 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -39,6 +39,8 @@ #define STRINGIFY(x) #x #define GLUE(x,y) x##y #define GLUE_(x,y) x##_##y +#define COMPARE(x,y) do { if ((x)<(y)) return -1; if ((x)>(y)) return 1; } while(0) +#define REV_COMPARE(x,y) COMPARE(y,x) /* Logging */ @@ -68,6 +70,8 @@ void assert_failed(void) NONRET; #define ASSERT(x) do { if (__builtin_constant_p(x) && !(x)) assert_failed(); } while(0) #endif +#define COMPILE_ASSERT(name,x) typedef char _COMPILE_ASSERT_##name[!!(x)-1] + #ifdef LOCAL_DEBUG #define DBG(x,y...) log(L_DEBUG, x,##y) #else