From: Karel Zak Date: Tue, 2 Aug 2011 10:30:57 +0000 (+0200) Subject: include: [bitops.h] make return values consistent X-Git-Tag: v2.20-rc2~126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1425592a2970b53a5941c3efe59197a3f418259;p=thirdparty%2Futil-linux.git include: [bitops.h] make return values consistent The *_to_cpu() and cpu_to_*() macros have to return always the same date types independently on CPU type. Signed-off-by: Karel Zak --- diff --git a/include/bitops.h b/include/bitops.h index 80d6f6f074..81375d0604 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -51,29 +51,29 @@ #define cpu_to_le16(x) swab16(x) #define cpu_to_le32(x) swab32(x) #define cpu_to_le64(x) swab64(x) -#define cpu_to_be16(x) (x) -#define cpu_to_be32(x) (x) -#define cpu_to_be64(x) (x) +#define cpu_to_be16(x) ((uint16_t)(x)) +#define cpu_to_be32(x) ((uint32_t)(x)) +#define cpu_to_be64(x) ((uint64_t)(x)) #define le16_to_cpu(x) swab16(x) #define le32_to_cpu(x) swab32(x) #define le64_to_cpu(x) swab64(x) -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define be64_to_cpu(x) (x) +#define be16_to_cpu(x) ((uint16_t)(x)) +#define be32_to_cpu(x) ((uint32_t)(x)) +#define be64_to_cpu(x) ((uint64_t)(x)) #else /* !WORDS_BIGENDIAN */ -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_le64(x) (x) +#define cpu_to_le16(x) ((uint16_t)(x)) +#define cpu_to_le32(x) ((uint32_t)(x)) +#define cpu_to_le64(x) ((uint64_t)(x)) #define cpu_to_be16(x) swab16(x) #define cpu_to_be32(x) swab32(x) #define cpu_to_be64(x) swab64(x) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) +#define le16_to_cpu(x) ((uint16_t)(x)) +#define le32_to_cpu(x) ((uint32_t)(x)) +#define le64_to_cpu(x) ((uint64_t)(x)) #define be16_to_cpu(x) swab16(x) #define be32_to_cpu(x) swab32(x) #define be64_to_cpu(x) swab64(x)