diff options
author | marius <marius@FreeBSD.org> | 2010-10-08 14:59:45 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2010-10-08 14:59:45 +0000 |
commit | 6074b9919be0ccfcca13ada88c96f56e2b3aebfb (patch) | |
tree | aa427e02bcaa3cb8046e44f3c12b18a61bf680cf /sys/sparc64 | |
parent | 5287fd7bac78b59f936ea19a0274c83b50b3c29a (diff) | |
download | FreeBSD-src-6074b9919be0ccfcca13ada88c96f56e2b3aebfb.zip FreeBSD-src-6074b9919be0ccfcca13ada88c96f56e2b3aebfb.tar.gz |
In the replacement text of the __bswapN_const() macros cast the argument
to the expected type so they work like the corresponding __bswapN_var()
functions and the compiler doesn't complain when arguments of different
width are passed.
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/include/endian.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/sparc64/include/endian.h b/sys/sparc64/include/endian.h index 1744784..2ca467e 100644 --- a/sys/sparc64/include/endian.h +++ b/sys/sparc64/include/endian.h @@ -69,18 +69,20 @@ #define __is_constant(x) 0 #endif -#define __bswap16_const(x) ((((x) >> 8) & 0xff) | \ - (((x) << 8) & 0xff00)) -#define __bswap32_const(x) ((((x) >> 24) & 0xff) | \ - (((x) >> 8) & 0xff00) | (((x) << 8) & 0xff0000) | \ - (((x) << 24) & 0xff000000)) -#define __bswap64_const(x) ((((x) >> 56) & 0xff) | \ - (((x) >> 40) & 0xff00) | (((x) >> 24) & 0xff0000) | \ - (((x) >> 8) & 0xff000000) | \ - (((x) << 8) & ((__uint64_t)0xff << 32)) | \ - (((x) << 24) & ((__uint64_t)0xff << 40)) | \ - (((x) << 40) & ((__uint64_t)0xff << 48)) | \ - (((x) << 56) & ((__uint64_t)0xff << 56))) +#define __bswap16_const(x) ((((__uint16_t)(x) >> 8) & 0xff) | \ + (((__uint16_t)(x) << 8) & 0xff00)) +#define __bswap32_const(x) ((((__uint32_t)(x) >> 24) & 0xff) | \ + (((__uint32_t)(x) >> 8) & 0xff00) | \ + (((__uint32_t)(x)<< 8) & 0xff0000) | \ + (((__uint32_t)(x) << 24) & 0xff000000)) +#define __bswap64_const(x) ((((__uint64_t)(x) >> 56) & 0xff) | \ + (((__uint64_t)(x) >> 40) & 0xff00) | \ + (((__uint64_t)(x) >> 24) & 0xff0000) | \ + (((__uint64_t)(x) >> 8) & 0xff000000) | \ + (((__uint64_t)(x) << 8) & ((__uint64_t)0xff << 32)) | \ + (((__uint64_t)(x) << 24) & ((__uint64_t)0xff << 40)) | \ + (((__uint64_t)(x) << 40) & ((__uint64_t)0xff << 48)) | \ + (((__uint64_t)(x) << 56) & ((__uint64_t)0xff << 56))) static __inline __uint16_t __bswap16_var(__uint16_t _x) |