#define __ENDIAN_DEFINED 1
#endif /* sun */
+/* AIX */
+#if defined(_AIX)
+#include <sys/machine.h>
+#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 */
/* 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)))