--- libecb/ecb.h 2011/05/26 17:57:32 1.10 +++ libecb/ecb.h 2011/05/26 18:17:45 1.12 @@ -32,7 +32,17 @@ #include -#define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) +/* many compilers define _GNUC_ to some versions but then only implement + * what their idiot authors think are the "more important" extensions, + * causing enourmous grief for some better fake benchmark numbers or so. + * we try to detect these and simply assume they are not gcc - if they have + * an issue with that they should have done it right in the first place. + */ +#if defined(__INTEL_COMPILER) || defined(__SUNPRO_C) || defined(__llvm__) +# define ECB_GCC_VERSION(major,minor) 0 +#else +# define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) +#endif #ifndef __cplusplus # if __STDC_VERSION__ >= 199901L @@ -89,8 +99,8 @@ /* put into ifs if you are very sure that the expression */ /* is mostly true or mosty false. note that these return */ /* booleans, not the expression. */ -#define ecb_unlikely(expr) ecb_expect ((expr) ? 1 : 0, 0) -#define ecb_likely(expr) ecb_expect ((expr) ? 1 : 0, 1) +#define ecb_unlikely(expr) ecb_expect (!!(expr), 0) +#define ecb_likely(expr) ecb_expect (!!(expr), 1) /* try to tell the compiler that some condition is definitely true */ #define ecb_assume(cond) do { if (!(cond)) unreachable (); } while (0) @@ -162,7 +172,7 @@ } #if ECB_GCC_VERSION(4,3) -# define ecb_bswap32(x) __builtin_bswap32 (x) +ECB_GCC_VERSION uint32_t ecb_bswap32 (uint32_t x) { return __builtin_bswap32 (x); } #else ECB_GCC_VERSION uint32_t ecb_bswap32 (uint32_t x)