parent
a259a69c8d
commit
77c794f202
|
@ -92,14 +92,26 @@
|
|||
#define __cpu_to_le64(x) bswap_64(x)
|
||||
|
||||
/* For architectures that do not provide some/all of the constant versions. */
|
||||
#if defined HAVE_DECL___BSWAP_CONSTANT_16 && !HAVE_DECL___BSWAP_CONSTANT_16
|
||||
#define __bswap_constant_16(x) bswap_16(x)
|
||||
#ifndef __bswap_constant_16
|
||||
#define __bswap_constant_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
|
||||
#endif
|
||||
#if defined HAVE_DECL___BSWAP_CONSTANT_32 && !HAVE_DECL___BSWAP_CONSTANT_32
|
||||
#define __bswap_constant_32(x) bswap_32(x)
|
||||
#ifndef __bswap_constant_32
|
||||
#define __bswap_constant_32(x) \
|
||||
((((x) & 0xff000000) >> 24) | \
|
||||
(((x) & 0x00ff0000) >> 8) | \
|
||||
(((x) & 0x0000ff00) << 8) | \
|
||||
(((x) & 0x000000ff) << 24))
|
||||
#endif
|
||||
#if defined HAVE_DECL___BSWAP_CONSTANT_64 && !HAVE_DECL___BSWAP_CONSTANT_64
|
||||
#define __bswap_constant_64(x) bswap_64(x)
|
||||
#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 __constant_le16_to_cpu(x) __bswap_constant_16(x)
|
||||
|
|
Loading…
Reference in New Issue