diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-02-15 02:39:57 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-02-15 02:39:57 +0400 |
commit | bd47d85d38ee5fb1fb8a37d006f51443f67a2061 (patch) | |
tree | 841ff2ef9cb106701b3923b64f15c1cb4426c6f3 | |
parent | fcd5ba8fbdf745fd6dac672d8891260bdc5669c9 (diff) |
utils: make le16 endian conversion functions work with arguments that have side effects
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | utils.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -99,7 +99,7 @@ void clock_gettime(int type, struct timespec *tv); #define __LITTLE_ENDIAN LITTLE_ENDIAN #endif -#define __u_bswap16(x) ((uint16_t)((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))) +#define __u_bswap16(x) ({ uint16_t val = (x); ((uint16_t)(((val >> 8) & 0xffu) | ((val & 0xffu) << 8))); }) #if _GNUC_MIN_VER(4, 2) #define __u_bswap32(x) __builtin_bswap32(x) |