--- libecb/ecb.h 2011/06/13 08:19:29 1.44 +++ libecb/ecb.h 2011/06/17 16:17:26 1.48 @@ -56,7 +56,7 @@ * an issue with that they should have done it right in the first place. */ #ifndef ECB_GCC_VERSION - #if defined(__INTEL_COMPILER) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__llvm__) || defined(__clang__) + #if !defined(__GNUC_MINOR__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__llvm__) || defined(__clang__) #define ECB_GCC_VERSION(major,minor) 0 #else #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) @@ -66,13 +66,13 @@ #define ECB_C99 (__STDC_VERSION__ >= 199901L) #if __cplusplus - #define ECB_INLINE static inline + #define ecb_inline static inline #elif ECB_GCC_VERSION(2,5) - #define ECB_INLINE static __inline__ + #define ecb_inline static __inline__ #elif ECB_C99 - #define ECB_INLINE static inline + #define ecb_inline static inline #else - #define ECB_INLINE static + #define ecb_inline static #endif #if ECB_GCC_VERSION(3,3) @@ -90,7 +90,7 @@ #define ECB_STRINGIFY_(a) # a #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) -#define ecb_function_ ECB_INLINE +#define ecb_function_ ecb_inline #if ECB_GCC_VERSION(3,1) #define ecb_attribute(attrlist) __attribute__(attrlist) @@ -147,7 +147,7 @@ { int r = 0; - x &= -x; /* this isolates the lowest bit */ + x &= ~x + 1; /* this isolates the lowest bit */ if (x & 0xaaaaaaaa) r += 1; if (x & 0xcccccccc) r += 2; @@ -236,15 +236,15 @@ #define ecb_array_length(name) (sizeof (name) / sizeof (name [0])) #endif -ECB_INLINE uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const; -ECB_INLINE uint32_t +ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const; +ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); } -ECB_INLINE uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const; -ECB_INLINE uint32_t +ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const; +ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count);