aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2023-08-15 23:52:26 +0200
committerTheo Buehler <tb@openbsd.org>2023-08-16 00:03:48 +0200
commit3c49cfb3447f61ced5bb64e8a23cc5abd4e84a2b (patch)
tree0643187c7e6a6a15799d7d1f0f33baddf66fef9f /include
parentcaa119b41813664fc357d60880b23643ad2ecbaa (diff)
downloadportable-3c49cfb3447f61ced5bb64e8a23cc5abd4e84a2b.tar.gz
portable-3c49cfb3447f61ced5bb64e8a23cc5abd4e84a2b.tar.bz2
portable-3c49cfb3447f61ced5bb64e8a23cc5abd4e84a2b.zip
Add htole32 and le32toh for macos and windows
Windows assumes little endian for now...
Diffstat (limited to 'include')
-rw-r--r--include/compat/endian.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/compat/endian.h b/include/compat/endian.h
index 928affe..0945ece 100644
--- a/include/compat/endian.h
+++ b/include/compat/endian.h
@@ -51,7 +51,9 @@
51#include <libkern/OSByteOrder.h> 51#include <libkern/OSByteOrder.h>
52#define be16toh(x) OSSwapBigToHostInt16((x)) 52#define be16toh(x) OSSwapBigToHostInt16((x))
53#define htobe16(x) OSSwapHostToBigInt16((x)) 53#define htobe16(x) OSSwapHostToBigInt16((x))
54#define le32toh(x) OSSwapLittleToHostInt32((x))
54#define be32toh(x) OSSwapBigToHostInt32((x)) 55#define be32toh(x) OSSwapBigToHostInt32((x))
56#define htole32(x) OSSwapHostToLittleInt32(x)
55#define htobe32(x) OSSwapHostToBigInt32(x) 57#define htobe32(x) OSSwapHostToBigInt32(x)
56#define htole64(x) OSSwapHostToLittleInt64(x) 58#define htole64(x) OSSwapHostToLittleInt64(x)
57#define htobe64(x) OSSwapHostToBigInt64(x) 59#define htobe64(x) OSSwapHostToBigInt64(x)
@@ -64,7 +66,9 @@
64 66
65#define be16toh(x) ntohs((x)) 67#define be16toh(x) ntohs((x))
66#define htobe16(x) htons((x)) 68#define htobe16(x) htons((x))
69#define le32toh(x) (x)
67#define be32toh(x) ntohl((x)) 70#define be32toh(x) ntohl((x))
71#define htole32(x) (x)
68#define htobe32(x) ntohl((x)) 72#define htobe32(x) ntohl((x))
69#define be64toh(x) ntohll((x)) 73#define be64toh(x) ntohll((x))
70 74