diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2017-04-21 19:04:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2017-04-21 19:04:23 +0000 |
commit | 027f553197e77bbc1daa0e1d6492e30afe17a164 (patch) | |
tree | 5514696cc6263ac73cf9cd3091a853fbd2603f76 | |
parent | 65b10e6aba41deb8ef6a8fe2235da879bf750072 (diff) |
Cast the result of the __swapXX macros to the proper type.
The ternary operator was causing the result to be promoted to
int for __swap16. Fixes warning with clang. OK guenther@
-rw-r--r-- | sys/sys/_endian.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h index c2e16a4a06f..25366cc188a 100644 --- a/sys/sys/_endian.h +++ b/sys/sys/_endian.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _endian.h,v 1.1 2014/07/12 16:25:08 guenther Exp $ */ +/* $OpenBSD: _endian.h,v 1.2 2017/04/21 19:04:22 millert Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -110,22 +110,22 @@ #define __swap16(x) __statement({ \ __uint16_t __swap16_x = (x); \ \ - __builtin_constant_p(x) ? __swap16gen(__swap16_x) : \ - __swap16md(__swap16_x); \ + (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(__swap16_x) :\ + __swap16md(__swap16_x)); \ }) #define __swap32(x) __statement({ \ __uint32_t __swap32_x = (x); \ \ - __builtin_constant_p(x) ? __swap32gen(__swap32_x) : \ - __swap32md(__swap32_x); \ + (__uint32_t)(__builtin_constant_p(x) ? __swap32gen(__swap32_x) :\ + __swap32md(__swap32_x)); \ }) #define __swap64(x) __statement({ \ __uint64_t __swap64_x = (x); \ \ - __builtin_constant_p(x) ? __swap64gen(__swap64_x) : \ - __swap64md(__swap64_x); \ + (__uint64_t)(__builtin_constant_p(x) ? __swap64gen(__swap64_x) :\ + __swap64md(__swap64_x)); \ }) #else |