}
#endif
+/* Needed for Glibc like endiness check */
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+
/* Sanity check the defines. We don't handle weird endianness. */
#if !HAVE_LITTLE_ENDIAN && !HAVE_BIG_ENDIAN
#error "Unknown endian"
#elif HAVE_LITTLE_ENDIAN && HAVE_BIG_ENDIAN
#error "Can't compile for both big and little endian."
+#elif HAVE_LITTLE_ENDIAN
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#elif HAVE_BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
#endif
+
#ifdef __CHECKER__
/* sparse needs forcing to remove bitwise attribute from ccan/short_types */
#define ENDIAN_CAST __attribute__((force))
*/
static inline beint64_t cpu_to_be64(uint64_t native)
{
- return ((ENDIAN_CAST beint64_t)BSWAP_64(native));
return CPU_TO_BE64(native);
}