X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fstdendian.h;h=9ab0fb5944dcec8769abcde388d9edf1433d4786;hb=6c170c99262c1d9678943122428f6d9f1353aaf6;hp=f84a03dccfa2d5492167053fa2d68f7c54cd23a5;hpb=bdaaa0e6e180dd017e3fda1b070f413d4b6e3492;p=collectd.git diff --git a/src/stdendian.h b/src/stdendian.h index f84a03dc..9ab0fb59 100644 --- a/src/stdendian.h +++ b/src/stdendian.h @@ -109,6 +109,23 @@ #define __ENDIAN_DEFINED 1 #endif /* sun */ +/* AIX */ +#if defined(_AIX) +#include +#if BYTE_ORDER == LITTLE_ENDIAN +#define _LITTLE_ENDIAN 1234 +#define _BIG_ENDIAN 4321 +#define _BYTE_ORDER _LITTLE_ENDIAN +#elif BYTE_ORDER == BIG_ENDIAN +#define _LITTLE_ENDIAN 1234 +#define _BIG_ENDIAN 4321 +#define _BYTE_ORDER _BIG_ENDIAN +#else +#error Could not determine CPU byte order for AIX +#endif +#define __ENDIAN_DEFINED 1 +#endif /* AIX */ + /* Windows */ #if defined(_WIN32) || defined(_MSC_VER) /* assumes all Microsoft targets are little endian */ @@ -173,7 +190,7 @@ /* handle missing __builtin_bswap16 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 */ #if defined __GNUC__ -/* define bswap16(x) __builtin_bswap16(x) */ +#define bswap16(x) __builtin_bswap16(x) #else #define bswap16(x) \ ((uint16_t)((((uint16_t)(x)&0xff00) >> 8) | (((uint16_t)(x)&0x00ff) << 8)))