lib: add Solaris support to the portable endian header

Solaris does not provide <endian.h> or <sys/endian.h>, but it does expose
byte-order definitions and conversion helpers via <sys/isa_defs.h> and
<sys/byteorder.h>.

Add a __sun branch so the portable header defines __BYTE_ORDER and the
htobe*/le*toh conversions on Solaris.

Co-authored-by: Amaan Qureshi <git@amaanq.com>
This commit is contained in:
Petr Sumbera 2026-04-01 15:18:10 +02:00 committed by Amaan Qureshi
parent 0f6780b9a3
commit 77cb23fccc

View file

@ -41,6 +41,25 @@
# include <sys/endian.h>
#elif defined(__sun)
# include <sys/byteorder.h>
# 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