feat: add config replication fields to myconf_t, cluster_t, ha_state_t, persist_t; create byteorder.h

This commit is contained in:
Rongsong Shen 2026-05-13 14:15:30 +00:00
parent 78adf3f843
commit 2c375cf476
5 changed files with 96 additions and 1 deletions

18
src/include/byteorder.h Normal file
View file

@ -0,0 +1,18 @@
#pragma once
/* Portable be64toh() for non-glibc or pre-2.25 targets. */
#if defined(__linux__)
# include <endian.h>
#elif defined(__APPLE__)
# include <machine/endian.h>
# include <libkern/OSByteOrder.h>
# define be64toh(x) OSSwapBigToHostInt64(x)
#else
# include <stdint.h>
static inline uint64_t be64toh(uint64_t x) {
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
return __builtin_bswap64(x);
# else
return x;
# endif
}
#endif