utils.h: make 16-bit little endian conversion robust against pointer subtraction...
authorFelix Fietkau <nbd@openwrt.org>
Thu, 14 Feb 2013 21:02:56 +0000 (22:02 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 14 Feb 2013 21:02:56 +0000 (22:02 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
utils.h

diff --git a/utils.h b/utils.h
index 03cecb0bd89e9eec7594600c84877ee938be4dbd..41ea02cc95b6f07acc07fe50449714590e1a9b74 100644 (file)
--- a/utils.h
+++ b/utils.h
@@ -113,11 +113,11 @@ void clock_gettime(int type, struct timespec *tv);
 
 #define cpu_to_be64(x) __u_bswap64(x)
 #define cpu_to_be32(x) __u_bswap32(x)
-#define cpu_to_be16(x) __u_bswap16((uint16_t) x)
+#define cpu_to_be16(x) __u_bswap16((uint16_t) (x))
 
 #define be64_to_cpu(x) __u_bswap64(x)
 #define be32_to_cpu(x) __u_bswap32(x)
-#define be16_to_cpu(x) __u_bswap16((uint16_t) x)
+#define be16_to_cpu(x) __u_bswap16((uint16_t) (x))
 
 #define cpu_to_le64(x) (x)
 #define cpu_to_le32(x) (x)
@@ -131,11 +131,11 @@ void clock_gettime(int type, struct timespec *tv);
 
 #define cpu_to_le64(x) __u_bswap64(x)
 #define cpu_to_le32(x) __u_bswap32(x)
-#define cpu_to_le16(x) __u_bswap16((uint16_t) x)
+#define cpu_to_le16(x) __u_bswap16((uint16_t) (x))
 
 #define le64_to_cpu(x) __u_bswap64(x)
 #define le32_to_cpu(x) __u_bswap32(x)
-#define le16_to_cpu(x) __u_bswap16((uint16_t) x)
+#define le16_to_cpu(x) __u_bswap16((uint16_t) (x))
 
 #define cpu_to_be64(x) (x)
 #define cpu_to_be32(x) (x)