aboutsummaryrefslogtreecommitdiff
path: root/src/include/k5-platform.h
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2010-02-20 07:37:13 +0000
committerKen Raeburn <raeburn@mit.edu>2010-02-20 07:37:13 +0000
commitfc3f2e78462b01338055cadc1e224e29d4ed4e9a (patch)
treeceb127a3308d81d891bead1caa9e4f151f0df016 /src/include/k5-platform.h
parent7ede8b77e97d1069f980b513c93c5a33f9911f41 (diff)
downloadkrb5-fc3f2e78462b01338055cadc1e224e29d4ed4e9a.zip
krb5-fc3f2e78462b01338055cadc1e224e29d4ed4e9a.tar.gz
krb5-fc3f2e78462b01338055cadc1e224e29d4ed4e9a.tar.bz2
Use bswap16 and bswap32 on NetBSD
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23741 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/k5-platform.h')
-rw-r--r--src/include/k5-platform.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index fd3ceec..e656b52 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -526,8 +526,7 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
# ifdef HAVE_BSWAP_64
# define SWAP64 bswap_64
# endif
-#endif
-#if TARGET_OS_MAC
+#elif TARGET_OS_MAC
# include <architecture/byte_order.h>
# if 0 /* This causes compiler warnings. */
# define SWAP16 OSSwapInt16
@@ -540,6 +539,19 @@ static inline unsigned int k5_swap16 (unsigned int x) {
# endif
# define SWAP32 OSSwapInt32
# define SWAP64 OSSwapInt64
+#elif defined(HAVE_SYS_BSWAP_H)
+/* XXX NetBSD/x86 5.0.1 defines bswap16 and bswap32 as inline
+ functions only, so autoconf doesn't pick up on their existence.
+ So, no feature macro test for them here. The 64-bit version isn't
+ inline at all, though, for whatever reason. */
+# include <sys/bswap.h>
+# define SWAP16 bswap16
+# define SWAP32 bswap32
+/* However, bswap64 causes lots of warnings about 'long long'
+ constants; probably only on 32-bit platforms. */
+# if LONG_MAX > 0x7fffffffL
+# define SWAP64 bswap64
+# endif
#endif
/* Note that on Windows at least this file can be included from C++