aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/include/endian.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-03-09 20:34:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-03-09 20:34:31 +0000
commit63d094a7e2f19c1e048de624ef028d2a3851b124 (patch)
tree3cce8341db1182b40e9d74239f83152f65e58007 /sys/sparc64/include/endian.h
parentad47abd20c48a4d51adb39280ac8cd331977fd31 (diff)
downloadsrc-63d094a7e2f19c1e048de624ef028d2a3851b124.tar.gz
src-63d094a7e2f19c1e048de624ef028d2a3851b124.zip
Add casts to __uint16_t to the __bswap16() macros on all arches which
didn't already have them. This is because the ternary expression will return int, due to the Usual Arithmetic Conversions. Such casts are not needed for the 32 and 64 bit variants. While here, add additional parentheses around the x86 variant, to protect against unintended consequences. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=232745
Diffstat (limited to 'sys/sparc64/include/endian.h')
-rw-r--r--sys/sparc64/include/endian.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/sparc64/include/endian.h b/sys/sparc64/include/endian.h
index 2ca467e409fb..38e7c3030707 100644
--- a/sys/sparc64/include/endian.h
+++ b/sys/sparc64/include/endian.h
@@ -109,8 +109,8 @@ __bswap64_var(__uint64_t _x)
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
}
-#define __bswap16(x) (__is_constant(x) ? __bswap16_const(x) : \
- __bswap16_var(x))
+#define __bswap16(x) ((__uint16_t)(__is_constant(x) ? __bswap16_const(x) : \
+ __bswap16_var(x)))
#define __bswap32(x) (__is_constant(x) ? __bswap32_const(x) : \
__bswap32_var(x))
#define __bswap64(x) (__is_constant(x) ? __bswap64_const(x) : \