Fix endian.h handling

if it exists we need to include it to get htobe16() et al
This commit is contained in:
sfan5
2026-09-28 21:49:53 +02:00
parent bdc785b683
commit 6d4ac28487
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -70,7 +70,10 @@
* endian.h compatibility shim
*/
#if defined(_WIN32)
#if defined(HAVE_ENDIAN_H)
#include <endian.h>
#elif defined(_WIN32)
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
@@ -85,9 +88,6 @@
#define BYTE_ORDER BIG_ENDIAN
#endif
#elif defined(HAVE_ENDIAN_H)
#include <endian.h>
#elif defined(__MACH__) && defined(__APPLE__)
#include <machine/endian.h>
+3 -3
View File
@@ -16,14 +16,14 @@
#include <string_view>
/* make sure BYTE_ORDER macros are available */
#ifdef _WIN32
#if HAVE_ENDIAN_H
#include <endian.h>
#elif defined(_WIN32)
#define BYTE_ORDER 1234
#elif defined(__MACH__) && defined(__APPLE__)
#include <machine/endian.h>
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#include <sys/endian.h>
#elif HAVE_ENDIAN_H
#include <endian.h>
#else
#error "Can't detect endian (missing header)"
#endif