Implement SWAP16 for Mac without compiler warning
authorKen Raeburn <raeburn@mit.edu>
Sat, 22 Dec 2007 02:21:15 +0000 (02:21 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 22 Dec 2007 02:21:15 +0000 (02:21 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20194 dc483132-0cff-0310-8789-dd5450dbe970

src/include/k5-platform.h

index 90eddf5d7696e6e598756a3ed7e6395554ff494b..c9bcb8a52cf03d20e20f01417e8ac4295b17a69e 100644 (file)
@@ -520,7 +520,15 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
 #endif
 #if TARGET_OS_MAC
 # include <architecture/byte_order.h>
-# define SWAP16                        OSSwapInt16
+# if 0 /* This causes compiler warnings.  */
+#  define SWAP16               OSSwapInt16
+# else
+#  define SWAP16               k5_swap16
+static inline unsigned int k5_swap16 (unsigned int x) {
+    x &= 0xffff;
+    return (x >> 8) | ((x & 0xff) << 8);
+}
+# endif
 # define SWAP32                        OSSwapInt32
 # define SWAP64                        OSSwapInt64
 #endif