From aa568b5cf48fe5b4966d763015419c4dbf30df3b Mon Sep 17 00:00:00 2001 From: Joseph Shearer Date: Thu, 27 Jun 2024 21:21:40 -0400 Subject: [PATCH] fix: Add missing endian conversion macros to enable MacOS builds We had been manually hacking this into our headers to build locally. I _believe_ this is the correct place to put them, or at least this change allows Gazette to build on my Mac without hacks. --- consumer/store-sqlite/store.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/consumer/store-sqlite/store.cpp b/consumer/store-sqlite/store.cpp index 9a83d380..48c2a6d7 100644 --- a/consumer/store-sqlite/store.cpp +++ b/consumer/store-sqlite/store.cpp @@ -6,6 +6,27 @@ #include #include +#ifdef __APPLE__ + +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) + +#endif + // recFS is a sqlite3_vfs which records mutations of stateful SQLite DB files. struct recFS { sqlite3_vfs base; // C-style subclass (is-a sqlite3_vfs).