From 77cb23fccc7776cf69e802689c27aae83fff14af Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Wed, 1 Apr 2026 15:18:10 +0200 Subject: [PATCH] lib: add Solaris support to the portable endian header Solaris does not provide or , but it does expose byte-order definitions and conversion helpers via and . Add a __sun branch so the portable header defines __BYTE_ORDER and the htobe*/le*toh conversions on Solaris. Co-authored-by: Amaan Qureshi --- lib/src/portable/endian.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/src/portable/endian.h b/lib/src/portable/endian.h index 4b3bdb83b..70df2c874 100644 --- a/lib/src/portable/endian.h +++ b/lib/src/portable/endian.h @@ -41,6 +41,25 @@ # include +#elif defined(__sun) + +# include + +# define htobe16(x) BE_16(x) +# define htole16(x) LE_16(x) +# define be16toh(x) BE_16(x) +# define le16toh(x) LE_16(x) + +# define htobe32(x) BE_32(x) +# define htole32(x) LE_32(x) +# define be32toh(x) BE_32(x) +# define le32toh(x) LE_32(x) + +# define htobe64(x) BE_64(x) +# define htole64(x) LE_64(x) +# define be64toh(x) BE_64(x) +# define le64toh(x) LE_64(x) + #elif defined(__APPLE__) # define __BYTE_ORDER BYTE_ORDER # define __BIG_ENDIAN BIG_ENDIAN