From 0ae03b8ad8257e310a06bf3c496b8ce1fa6afb48 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 2 Jun 2006 05:37:47 +0000 Subject: [PATCH] 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 --- mdadm.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mdadm.h b/mdadm.h index 445af323..9113560a 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 -#include /* Redhat don't like to #include , and * some time include isn't enough, * and there is no standard conversion function so... */ +/* And dietlibc doesn't think byteswap is ok, so.. */ +/* #include */ +#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) -- 2.39.2