Yet another include file that someone doesn't like....
It seems byteswap.h isn't universally accepted, so we do it by hand... Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
parent
058574b1da
commit
0ae03b8ad8
18
mdadm.h
18
mdadm.h
|
@ -73,10 +73,26 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
|
|||
#include "bitmap.h"
|
||||
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
/* Redhat don't like to #include <asm/byteorder.h>, and
|
||||
* some time include <linux/byteorder/xxx_endian.h> isn't enough,
|
||||
* and there is no standard conversion function so... */
|
||||
/* And dietlibc doesn't think byteswap is ok, so.. */
|
||||
/* #include <byteswap.h> */
|
||||
#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
|
||||
((x) & 0xff00U) >> 8)
|
||||
#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
|
||||
((x) & 0xff000000U) >> 24 | \
|
||||
((x) & 0x0000ff00U) << 8 | \
|
||||
((x) & 0x00ff0000U) >> 8)
|
||||
#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
|
||||
((x) & 0xff00000000000000ULL) >> 56 | \
|
||||
((x) & 0x000000000000ff00ULL) << 40 | \
|
||||
((x) & 0x00ff000000000000ULL) >> 40 | \
|
||||
((x) & 0x0000000000ff0000ULL) << 24 | \
|
||||
((x) & 0x0000ff0000000000ULL) >> 24 | \
|
||||
((x) & 0x00000000ff000000ULL) << 8 | \
|
||||
((x) & 0x000000ff00000000ULL) >> 8)
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define __cpu_to_le16(_x) (_x)
|
||||
#define __cpu_to_le32(_x) (_x)
|
||||
|
|
Loading…
Reference in New Issue