mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 10:04:00 +08:00
endians.h: Cast the result of const endianness macros to the right type.
This fixes compiler warnings emitted when you compare an le32 value with e.g. 'const_cpu_to_le32(-1)' on a little-endian system, because previously the expansion of the macro expression 'const_cpu_to_le32(-1)' would be '(-1)' on a little-endian system but '(u32)((((u32)(-1) & 0xff000000u) >> 24) | (((u32)(-1) & 0x00ff0000u) >> 8) | (((u32)(-1) & 0x0000ff00u) << 8) | (((u32)(-1) & 0x000000ffu) << 24))' on a big-endian system, i.e. the type of the expanded expression would be 'int' (signed) in the little-endian case but 'u32' (unsigned) in the big-endian case. With this commit the type of the expanded expression will be 'le32' in both the little-endian and the big-endian case.
This commit is contained in:
parent
f463919310
commit
a207d4e86a
@ -264,36 +264,36 @@
|
||||
|
||||
/* Constant endianness conversion defines. */
|
||||
|
||||
#define const_le16_to_cpu(x) __constant_le16_to_cpu(x)
|
||||
#define const_le32_to_cpu(x) __constant_le32_to_cpu(x)
|
||||
#define const_le64_to_cpu(x) __constant_le64_to_cpu(x)
|
||||
#define const_le16_to_cpu(x) ((u16) __constant_le16_to_cpu(x))
|
||||
#define const_le32_to_cpu(x) ((u32) __constant_le32_to_cpu(x))
|
||||
#define const_le64_to_cpu(x) ((u64) __constant_le64_to_cpu(x))
|
||||
|
||||
#define const_cpu_to_le16(x) __constant_cpu_to_le16(x)
|
||||
#define const_cpu_to_le32(x) __constant_cpu_to_le32(x)
|
||||
#define const_cpu_to_le64(x) __constant_cpu_to_le64(x)
|
||||
#define const_cpu_to_le16(x) ((le16) __constant_cpu_to_le16(x))
|
||||
#define const_cpu_to_le32(x) ((le32) __constant_cpu_to_le32(x))
|
||||
#define const_cpu_to_le64(x) ((le64) __constant_cpu_to_le64(x))
|
||||
|
||||
#define const_sle16_to_cpu(x) __constant_le16_to_cpu((le16) x)
|
||||
#define const_sle32_to_cpu(x) __constant_le32_to_cpu((le32) x)
|
||||
#define const_sle64_to_cpu(x) __constant_le64_to_cpu((le64) x)
|
||||
#define const_sle16_to_cpu(x) ((s16) __constant_le16_to_cpu((le16) x))
|
||||
#define const_sle32_to_cpu(x) ((s32) __constant_le32_to_cpu((le32) x))
|
||||
#define const_sle64_to_cpu(x) ((s64) __constant_le64_to_cpu((le64) x))
|
||||
|
||||
#define const_cpu_to_sle16(x) __constant_cpu_to_le16((u16) x)
|
||||
#define const_cpu_to_sle32(x) __constant_cpu_to_le32((u32) x)
|
||||
#define const_cpu_to_sle64(x) __constant_cpu_to_le64((u64) x)
|
||||
#define const_cpu_to_sle16(x) ((sle16) __constant_cpu_to_le16((u16) x))
|
||||
#define const_cpu_to_sle32(x) ((sle32) __constant_cpu_to_le32((u32) x))
|
||||
#define const_cpu_to_sle64(x) ((sle64) __constant_cpu_to_le64((u64) x))
|
||||
|
||||
#define const_be16_to_cpu(x) __constant_be16_to_cpu(x)
|
||||
#define const_be32_to_cpu(x) __constant_be32_to_cpu(x)
|
||||
#define const_be64_to_cpu(x) __constant_be64_to_cpu(x)
|
||||
#define const_be16_to_cpu(x) ((u16) __constant_be16_to_cpu(x)))
|
||||
#define const_be32_to_cpu(x) ((u32) __constant_be32_to_cpu(x)))
|
||||
#define const_be64_to_cpu(x) ((u64) __constant_be64_to_cpu(x)))
|
||||
|
||||
#define const_cpu_to_be16(x) __constant_cpu_to_be16(x)
|
||||
#define const_cpu_to_be32(x) __constant_cpu_to_be32(x)
|
||||
#define const_cpu_to_be64(x) __constant_cpu_to_be64(x)
|
||||
#define const_cpu_to_be16(x) ((be16) __constant_cpu_to_be16(x))
|
||||
#define const_cpu_to_be32(x) ((be32) __constant_cpu_to_be32(x))
|
||||
#define const_cpu_to_be64(x) ((be64) __constant_cpu_to_be64(x))
|
||||
|
||||
#define const_sbe16_to_cpu(x) __constant_be16_to_cpu((be16) x)
|
||||
#define const_sbe32_to_cpu(x) __constant_be32_to_cpu((be32) x)
|
||||
#define const_sbe64_to_cpu(x) __constant_be64_to_cpu((be64) x)
|
||||
#define const_sbe16_to_cpu(x) ((s16) __constant_be16_to_cpu((be16) x))
|
||||
#define const_sbe32_to_cpu(x) ((s32) __constant_be32_to_cpu((be32) x))
|
||||
#define const_sbe64_to_cpu(x) ((s64) __constant_be64_to_cpu((be64) x))
|
||||
|
||||
#define const_cpu_to_sbe16(x) __constant_cpu_to_be16((u16) x)
|
||||
#define const_cpu_to_sbe32(x) __constant_cpu_to_be32((u32) x)
|
||||
#define const_cpu_to_sbe64(x) __constant_cpu_to_be64((u64) x)
|
||||
#define const_cpu_to_sbe16(x) ((sbe16) __constant_cpu_to_be16((u16) x))
|
||||
#define const_cpu_to_sbe32(x) ((sbe32) __constant_cpu_to_be32((u32) x))
|
||||
#define const_cpu_to_sbe64(x) ((sbe64) __constant_cpu_to_be64((u64) x))
|
||||
|
||||
#endif /* defined _NTFS_ENDIANS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user