From cf2c2fde9c2e8aee31d99fbd468a7eeaf987cb1a Mon Sep 17 00:00:00 2001 From: dim Date: Fri, 9 Mar 2012 20:34:31 +0000 Subject: 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 --- sys/x86/include/endian.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/x86/include/endian.h') diff --git a/sys/x86/include/endian.h b/sys/x86/include/endian.h index ba101fa..2f95320 100644 --- a/sys/x86/include/endian.h +++ b/sys/x86/include/endian.h @@ -71,8 +71,8 @@ #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P #define __bswap16(x) \ - (__uint16_t)(__builtin_constant_p(x) ? \ - __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)) + ((__uint16_t)(__builtin_constant_p(x) ? \ + __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x))) #define __bswap32(x) \ (__builtin_constant_p(x) ? \ __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) -- cgit v1.1