From 48bfc2ce1445669aaddb80ab5bc08da8fffb3fc9 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sat, 1 Feb 2025 23:59:03 +0800 Subject: [PATCH] Fix for missing be64toh/htobe64 on macOS --- tools/common.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/common.h b/tools/common.h index 0fa849f6..34ef5ec4 100644 --- a/tools/common.h +++ b/tools/common.h @@ -120,6 +120,12 @@ # define ntohll(x) ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((uint64_t)(x) >> 32) # endif # endif +#elif defined(__APPLE__) +# if !defined(be64toh) +# include +# define be64toh(v) OSSwapBigToHostInt64(v) +# define htobe64(v) OSSwapHostToBigInt64(v) +# endif #endif #ifndef htonll