summaryrefslogtreecommitdiffstats
path: root/mdadm.h
diff options
context:
space:
mode:
Diffstat (limited to 'mdadm.h')
-rw-r--r--mdadm.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/mdadm.h b/mdadm.h
index 445af32..9113560 100644
--- a/mdadm.h
+++ b/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)