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

Comparing libecb/ecb.h (file contents):
Revision 1.7 by root, Thu May 26 17:38:25 2011 UTC vs.
Revision 1.8 by root, Thu May 26 17:43:41 2011 UTC

41# else 41# else
42# define ECB_INLINE inline /* yeah! */ 42# define ECB_INLINE inline /* yeah! */
43typedef int ecb_bool; 43typedef int ecb_bool;
44# endif 44# endif
45#endif 45#endif
46
47#define ECB_CONCAT_(a, b) a ## b
48#define ECB_CONCAT(a, b) ECB_CONCAT_(a, b)
49#define ECB_STRINGIFY_(a) # a
50#define ECB_STRINGIFY(a) ECB_STRINGIFY_(a)
46 51
47#define ECB_HEADER_INLINE static ECB_INLINE 52#define ECB_HEADER_INLINE static ECB_INLINE
48 53
49#if ECB_GCC_VERSION(3,1) 54#if ECB_GCC_VERSION(3,1)
50# define ecb_attribute(attrlist) __attribute__(attrlist) 55# define ecb_attribute(attrlist) __attribute__(attrlist)
134ECB_HEADER_INLINE ecb_bool ecb_little_endian () ecb_const { return ecb_byteorder_helper () == 0x44; }; 139ECB_HEADER_INLINE ecb_bool ecb_little_endian () ecb_const { return ecb_byteorder_helper () == 0x44; };
135 140
136#if ecb_cplusplus_does_not_suck 141#if ecb_cplusplus_does_not_suck
137// does not work for local types (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm) 142// does not work for local types (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm)
138template<typename T, int N> 143template<typename T, int N>
139static inline int array_length (const T (&arr)[N]) 144static inline int ecb_array_length (const T (&arr)[N])
140{ 145{
141 return N; 146 return N;
142} 147}
143#else 148#else
144#define ecb_array_length(name) (sizeof (name) / sizeof (name [0])) 149#define ecb_array_length(name) (sizeof (name) / sizeof (name [0]))
145#endif 150#endif
146 151
147ECB_INLINE uint32_t 152ECB_INLINE uint32_t
148ecb_rotate32_right (uint32_t c, unsigned int count = 1) 153ecb_rotr32 (uint32_t c, unsigned int count)
149{ 154{
150 return (c << (32 - count)) | (c >> count); 155 return (c << (32 - count)) | (c >> count);
151} 156}
152 157
153ECB_INLINE uint32_t 158ECB_INLINE uint32_t
154ecb_rotate32_left (uint32_t c, unsigned int count = 1) 159ecb_rotl32 (uint32_t c, unsigned int count)
155{ 160{
156 return (c >> (32 - count)) | (c << count); 161 return (c >> (32 - count)) | (c << count);
157} 162}
158 163
159#endif 164#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines