Provide our own __ntfs_bswap_constant_xx functions so we completely
avoid the mess that some architectures define only some of the constant bswap functions. (Logical change 1.318)edge.strict_endians
parent
491d7096ca
commit
a0cbfc4ce4
|
@ -91,36 +91,33 @@
|
|||
#define __cpu_to_le32(x) bswap_32(x)
|
||||
#define __cpu_to_le64(x) bswap_64(x)
|
||||
|
||||
/* For architectures that do not provide some/all of the constant versions. */
|
||||
#ifndef __bswap_constant_16
|
||||
#define __bswap_constant_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
|
||||
#endif
|
||||
#ifndef __bswap_constant_32
|
||||
#define __bswap_constant_32(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))
|
||||
#endif
|
||||
#ifndef __bswap_constant_64
|
||||
#define __bswap_constant_64(x) \
|
||||
((((x) & 0xff00000000000000ull) >> 56) | \
|
||||
(((x) & 0x00ff000000000000ull) >> 40) | \
|
||||
(((x) & 0x0000ff0000000000ull) >> 24) | \
|
||||
(((x) & 0x000000ff00000000ull) >> 8) | \
|
||||
(((x) & 0x00000000ff000000ull) << 8) | \
|
||||
(((x) & 0x0000000000ff0000ull) << 24) | \
|
||||
(((x) & 0x000000000000ff00ull) << 40) | \
|
||||
(((x) & 0x00000000000000ffull) << 56))
|
||||
#endif
|
||||
#define __ntfs_bswap_constant_16(x) \
|
||||
(u16)((((u16)(x) & 0xff00) >> 8) | \
|
||||
(((u16)(x) & 0x00ff) << 8))
|
||||
|
||||
#define __constant_le16_to_cpu(x) __bswap_constant_16(x)
|
||||
#define __constant_le32_to_cpu(x) __bswap_constant_32(x)
|
||||
#define __constant_le64_to_cpu(x) __bswap_constant_64(x)
|
||||
#define __ntfs_bswap_constant_32(x) \
|
||||
(u32)((((u32)(x) & 0xff000000u) >> 24) | \
|
||||
(((u32)(x) & 0x00ff0000u) >> 8) | \
|
||||
(((u32)(x) & 0x0000ff00u) << 8) | \
|
||||
(((u32)(x) & 0x000000ffu) << 24))
|
||||
|
||||
#define __constant_cpu_to_le16(x) __bswap_constant_16(x)
|
||||
#define __constant_cpu_to_le32(x) __bswap_constant_32(x)
|
||||
#define __constant_cpu_to_le64(x) __bswap_constant_64(x)
|
||||
#define __ntfs_bswap_constant_64(x) \
|
||||
(u64)((((u64)(x) & 0xff00000000000000ull) >> 56) | \
|
||||
(((u64)(x) & 0x00ff000000000000ull) >> 40) | \
|
||||
(((u64)(x) & 0x0000ff0000000000ull) >> 24) | \
|
||||
(((u64)(x) & 0x000000ff00000000ull) >> 8) | \
|
||||
(((u64)(x) & 0x00000000ff000000ull) << 8) | \
|
||||
(((u64)(x) & 0x0000000000ff0000ull) << 24) | \
|
||||
(((u64)(x) & 0x000000000000ff00ull) << 40) | \
|
||||
(((u64)(x) & 0x00000000000000ffull) << 56))
|
||||
|
||||
#define __constant_le16_to_cpu(x) __ntfs_bswap_constant_16((u16)(x))
|
||||
#define __constant_le32_to_cpu(x) __ntfs_bswap_constant_32((u32)(x))
|
||||
#define __constant_le64_to_cpu(x) __ntfs_bswap_constant_64((u64)(x))
|
||||
|
||||
#define __constant_cpu_to_le16(x) __ntfs_bswap_constant_16((u16)(x))
|
||||
#define __constant_cpu_to_le32(x) __ntfs_bswap_constant_32((u32)(x))
|
||||
#define __constant_cpu_to_le64(x) __ntfs_bswap_constant_64((u64)(x))
|
||||
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in New Issue