Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-02-15 01:02:56 +0400
committerFelix Fietkau <nbd@openwrt.org>2013-02-15 01:02:56 +0400
commitfcd5ba8fbdf745fd6dac672d8891260bdc5669c9 (patch)
tree4078717381c0ef2303809e478d73501542c23ac4 /utils.h
parentd01922625d21f97fcab757d0299586178333f1e0 (diff)
utils.h: make 16-bit little endian conversion robust against pointer subtraction arguments
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/utils.h b/utils.h
index 03cecb0..41ea02c 100644
--- 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)