* @brief Contains macro checks for different configurations.
*/
+#if __has_include(<endian.h>)
+#include <endian.h> // Recent posix
+#elif __has_include(<machine/endian.h>)
+#include <machine/endian.h> // Common place on older BSD derived systems
+#else
+#error no endian.h found
+#endif
+
#define PROTOZERO_LITTLE_ENDIAN 1234
#define PROTOZERO_BIG_ENDIAN 4321
# define PROTOZERO_BYTE_ORDER PROTOZERO_LITTLE_ENDIAN
#endif
+// Sanity check
+static_assert(PROTOZERO_BYTE_ORDER == BYTE_ORDER);
+
// Check whether __builtin_bswap is available
#if defined(__GNUC__) || defined(__clang__)
# define PROTOZERO_USE_BUILTIN_BSWAP