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

Comparing libeio/ecb.h (file contents):
Revision 1.15 by root, Wed Jul 25 16:12:28 2012 UTC vs.
Revision 1.16 by root, Tue Oct 9 04:53:53 2012 UTC

152 #define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST) 152 #define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST)
153 153
154 /* The __has_feature syntax from clang is so misdesigned that we cannot use it 154 /* The __has_feature syntax from clang is so misdesigned that we cannot use it
155 * without risking compile time errors with other compilers. We *could* 155 * without risking compile time errors with other compilers. We *could*
156 * define our own ecb_clang_has_feature, but I just can't be bothered to work 156 * define our own ecb_clang_has_feature, but I just can't be bothered to work
157 * around * this shit time and again. 157 * around this shit time and again.
158 * #elif defined __clang && __has_feature (cxx_atomic) 158 * #elif defined __clang && __has_feature (cxx_atomic)
159 * // see comment below (stdatomic.h) about the C11 memory model. 159 * // see comment below (stdatomic.h) about the C11 memory model.
160 * #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST) 160 * #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
161 */ 161 */
162 162
482ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const; 482ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const;
483ecb_inline unsigned char 483ecb_inline unsigned char
484ecb_byteorder_helper (void) 484ecb_byteorder_helper (void)
485{ 485{
486 /* the union code still generates code under pressure in gcc, */ 486 /* the union code still generates code under pressure in gcc, */
487 /* but less than using pointers, and always seem to */ 487 /* but less than using pointers, and always seems to */
488 /* successfully return a constant. */ 488 /* successfully return a constant. */
489 /* the reason why we have this horrible preprocessor mess */ 489 /* the reason why we have this horrible preprocessor mess */
490 /* is to avoid it in all cases, at least on common architectures */ 490 /* is to avoid it in all cases, at least on common architectures */
491 /* and yes, gcc defines __BYTE_ORDER__, g++ does not */ 491 /* or when using a recent enough gcc version (>= 4.6) */
492#if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64 492#if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64
493 return 0x44; 493 return 0x44;
494#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 494#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
495 return 0x44; 495 return 0x44;
496#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 496#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
497 retrurn 0x11; 497 return 0x11;
498#else 498#else
499 union 499 union
500 { 500 {
501 uint32_t i; 501 uint32_t i;
502 uint8_t c; 502 uint8_t c;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines