Make API CTF-agnostic
[babeltrace.git] / include / babeltrace / endian-internal.h
index 55f8d1ec0db346606e2b6a5b3ab243b26ce731b5..db04a9aef5e268c89e66a7e3552a7b691ad529bf 100644 (file)
@@ -66,6 +66,8 @@
 #define be64toh(x) BE_64(x)
 
 #elif defined(__MINGW32__)
+#include <stdint.h>
+
 #ifndef __BIG_ENDIAN
 #define __BIG_ENDIAN 4321
 #endif
 #define PDP_ENDIAN     __PDP_ENDIAN
 #define BYTE_ORDER     __BYTE_ORDER
 
+#define htobe16(x) (uint16_t) _byteswap_ushort(x)
+#define htole16(x) (x)
+#define be16toh(x) (uint16_t) _byteswap_ushort(x)
+#define le16toh(x) (x)
+
+#define htobe32(x) (uint32_t) _byteswap_ulong(x)
+#define htole32(x) (x)
+#define be32toh(x) (uint32_t) _byteswap_ulong(x)
+#define le32toh(x) (x)
+
+#define htobe64(x) (uint64_t) _byteswap_uint64(x)
+#define htole64(x) (x)
+#define be64toh(x) (uint64_t) _byteswap_uint64(x)
+#define le64toh(x) (x)
+
 #elif defined(__APPLE__)
 # include <machine/endian.h>
 # include <libkern/OSByteOrder.h>
 #endif /* __FLOAT_WORD_ORDER */
 #endif /* FLOAT_WORD_ORDER */
 
-#if (BYTE_ORDER == BIG_ENDIAN)
-# define BT_CTF_MY_BYTE_ORDER  BT_CTF_BYTE_ORDER_BIG_ENDIAN
-#else
-# define BT_CTF_MY_BYTE_ORDER  BT_CTF_BYTE_ORDER_LITTLE_ENDIAN
-#endif
-
 #endif /* _BABELTRACE_ENDIAN_H */
This page took 0.025926 seconds and 4 git commands to generate.