… | |
… | |
482 | ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const; |
482 | ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const; |
483 | ecb_inline unsigned char |
483 | ecb_inline unsigned char |
484 | ecb_byteorder_helper (void) |
484 | ecb_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__ |