platform_endian.h (499B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #ifndef _PLATFORM_ENDIAN_H_ #define _PLATFORM_ENDIAN_H_ #if defined( __linux__) || defined( __APPLE__ ) || defined( __OpenBSD__ ) # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define PLATFORM_LITTLE_ENDIAN 1 # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # define PLATFORM_BIG_ENDIAN 1 # else # error "I can't tell what byte order this machine uses" # endif #elif defined( _WIN32 ) # define PLATFORM_LITTLE_ENDIAN 1 #else # error new platform #endif #endif // _PLATFORM_ENDIAN_H_ |