aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/endian.h
diff options
context:
space:
mode:
authorMike Barcroft <mike@FreeBSD.org>2002-04-29 16:58:54 +0000
committerMike Barcroft <mike@FreeBSD.org>2002-04-29 16:58:54 +0000
commitd75cd4deb95a27c97a8630f346ac1c8a82b69365 (patch)
treeadbdf597483020e88945deb83bb053ae437e9fc0 /sys/sys/endian.h
parent8a7a68b108094746ea2bf54b8945c6b40151950f (diff)
downloadsrc-d75cd4deb95a27c97a8630f346ac1c8a82b69365.tar.gz
src-d75cd4deb95a27c97a8630f346ac1c8a82b69365.zip
Make this header self-reliant with regard to the types it uses.
Notes
Notes: svn path=/head/; revision=95737
Diffstat (limited to 'sys/sys/endian.h')
-rw-r--r--sys/sys/endian.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/sys/sys/endian.h b/sys/sys/endian.h
index 0675457e4632..027b59d2d71d 100644
--- a/sys/sys/endian.h
+++ b/sys/sys/endian.h
@@ -30,8 +30,24 @@
#define _SYS_ENDIAN_H_
#include <sys/cdefs.h>
+#include <sys/_types.h>
#include <machine/endian.h>
+#ifndef _UINT16_T_DECLARED
+typedef __uint16_t uint16_t;
+#define _UINT16_T_DECLARED
+#endif
+
+#ifndef _UINT32_T_DECLARED
+typedef __uint32_t uint32_t;
+#define _UINT32_T_DECLARED
+#endif
+
+#ifndef _UINT64_T_DECLARED
+typedef __uint64_t uint64_t;
+#define _UINT64_T_DECLARED
+#endif
+
/*
* General byte order swapping functions.
*/
@@ -47,27 +63,27 @@
#define htobe16(x) bswap16((x))
#define htobe32(x) bswap32((x))
#define htobe64(x) bswap64((x))
-#define htole16(x) ((__uint16_t)(x))
-#define htole32(x) ((__uint32_t)(x))
-#define htole64(x) ((__uint64_t)(x))
+#define htole16(x) ((uint16_t)(x))
+#define htole32(x) ((uint32_t)(x))
+#define htole64(x) ((uint64_t)(x))
#define be16toh(x) bswap16((x))
#define be32toh(x) bswap32((x))
#define be64toh(x) bswap64((x))
-#define le16toh(x) ((__uint16_t)(x))
-#define le32toh(x) ((__uint32_t)(x))
-#define le64toh(x) ((__uint64_t)(x))
+#define le16toh(x) ((uint16_t)(x))
+#define le32toh(x) ((uint32_t)(x))
+#define le64toh(x) ((uint64_t)(x))
#else /* _BYTE_ORDER != _LITTLE_ENDIAN */
-#define htobe16(x) ((__uint16_t)(x))
-#define htobe32(x) ((__uint32_t)(x))
-#define htobe64(x) ((__uint64_t)(x))
+#define htobe16(x) ((uint16_t)(x))
+#define htobe32(x) ((uint32_t)(x))
+#define htobe64(x) ((uint64_t)(x))
#define htole16(x) bswap16((x))
#define htole32(x) bswap32((x))
#define htole64(x) bswap64((x))
-#define be16toh(x) ((__uint16_t)(x))
-#define be32toh(x) ((__uint32_t)(x))
-#define be64toh(x) ((__uint64_t)(x))
+#define be16toh(x) ((uint16_t)(x))
+#define be32toh(x) ((uint32_t)(x))
+#define be64toh(x) ((uint64_t)(x))
#define le16toh(x) bswap16((x))
#define le32toh(x) bswap32((x))
#define le64toh(x) bswap64((x))