fix for macos

This commit is contained in:
2025-08-04 02:13:34 +01:00
parent 417d66faf3
commit 2ba60b38ae

View File

@@ -61,8 +61,17 @@ static inline uint64_t htole64(uint64_t x) {
return x; return x;
} }
#elif defined(__linux__)
#include <endian.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define htole32(x) OSSwapHostToLittleInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
// Add others as needed
#else #else
#include <endian.h> // On Linux/BSD #error "Unsupported platform"
#endif #endif
char *get_current_directory() { char *get_current_directory() {