ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libecb/ecb.h
(Generate patch)

Comparing libecb/ecb.h (file contents):
Revision 1.44 by root, Mon Jun 13 08:19:29 2011 UTC vs.
Revision 1.46 by root, Fri Jun 17 15:17:26 2011 UTC

64#endif 64#endif
65 65
66#define ECB_C99 (__STDC_VERSION__ >= 199901L) 66#define ECB_C99 (__STDC_VERSION__ >= 199901L)
67 67
68#if __cplusplus 68#if __cplusplus
69 #define ECB_INLINE static inline 69 #define ecb_inline static inline
70#elif ECB_GCC_VERSION(2,5) 70#elif ECB_GCC_VERSION(2,5)
71 #define ECB_INLINE static __inline__ 71 #define ecb_inline static __inline__
72#elif ECB_C99 72#elif ECB_C99
73 #define ECB_INLINE static inline 73 #define ecb_inline static inline
74#else 74#else
75 #define ECB_INLINE static 75 #define ecb_inline static
76#endif 76#endif
77 77
78#if ECB_GCC_VERSION(3,3) 78#if ECB_GCC_VERSION(3,3)
79 #define ecb_restrict __restrict__ 79 #define ecb_restrict __restrict__
80#elif ECB_C99 80#elif ECB_C99
88#define ECB_CONCAT_(a, b) a ## b 88#define ECB_CONCAT_(a, b) a ## b
89#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) 89#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
90#define ECB_STRINGIFY_(a) # a 90#define ECB_STRINGIFY_(a) # a
91#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) 91#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
92 92
93#define ecb_function_ ECB_INLINE 93#define ecb_function_ ecb_inline
94 94
95#if ECB_GCC_VERSION(3,1) 95#if ECB_GCC_VERSION(3,1)
96 #define ecb_attribute(attrlist) __attribute__(attrlist) 96 #define ecb_attribute(attrlist) __attribute__(attrlist)
97 #define ecb_is_constant(expr) __builtin_constant_p (expr) 97 #define ecb_is_constant(expr) __builtin_constant_p (expr)
98 #define ecb_expect(expr,value) __builtin_expect ((expr),(value)) 98 #define ecb_expect(expr,value) __builtin_expect ((expr),(value))
145 ecb_function_ int 145 ecb_function_ int
146 ecb_ctz32 (uint32_t x) 146 ecb_ctz32 (uint32_t x)
147 { 147 {
148 int r = 0; 148 int r = 0;
149 149
150 x &= -x; /* this isolates the lowest bit */ 150 x &= (uint32_t)-(int32_t)x; /* this isolates the lowest bit */
151 151
152 if (x & 0xaaaaaaaa) r += 1; 152 if (x & 0xaaaaaaaa) r += 1;
153 if (x & 0xcccccccc) r += 2; 153 if (x & 0xcccccccc) r += 2;
154 if (x & 0xf0f0f0f0) r += 4; 154 if (x & 0xf0f0f0f0) r += 4;
155 if (x & 0xff00ff00) r += 8; 155 if (x & 0xff00ff00) r += 8;
234 } 234 }
235#else 235#else
236 #define ecb_array_length(name) (sizeof (name) / sizeof (name [0])) 236 #define ecb_array_length(name) (sizeof (name) / sizeof (name [0]))
237#endif 237#endif
238 238
239ECB_INLINE uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const; 239ecb_inline uint32_t ecb_rotr32 (uint32_t x, unsigned int count) ecb_const;
240ECB_INLINE uint32_t 240ecb_inline uint32_t
241ecb_rotr32 (uint32_t x, unsigned int count) 241ecb_rotr32 (uint32_t x, unsigned int count)
242{ 242{
243 return (x << (32 - count)) | (x >> count); 243 return (x << (32 - count)) | (x >> count);
244} 244}
245 245
246ECB_INLINE uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const; 246ecb_inline uint32_t ecb_rotl32 (uint32_t x, unsigned int count) ecb_const;
247ECB_INLINE uint32_t 247ecb_inline uint32_t
248ecb_rotl32 (uint32_t x, unsigned int count) 248ecb_rotl32 (uint32_t x, unsigned int count)
249{ 249{
250 return (x >> (32 - count)) | (x << count); 250 return (x >> (32 - count)) | (x << count);
251} 251}
252 252

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines