From a34fc3d4ad3c9f80737352df70ddc6b68a6501ae Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 17 Dec 2007 13:18:12 +0100 Subject: [PATCH] include: add bitops.h with swab{16,32,64} macros Signed-off-by: Karel Zak --- include/bitops.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/bitops.h b/include/bitops.h index 4ae0ff8e..7b2b17e7 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -32,20 +32,38 @@ #ifdef WORDS_BIGENDIAN + #define cpu_to_le16(x) swab16(x) #define cpu_to_le32(x) swab32(x) #define cpu_to_le64(x) swab64(x) #define cpu_to_be16(x) (x) #define cpu_to_be32(x) (x) #define cpu_to_be64(x) (x) -#else + +#define le16_to_cpu(x) swab16(x) +#define le32_to_cpu(x) swab32(x) +#define le64_to_cpu(x) swab64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) +#define be64_to_cpu(x) (x) + +#else /* !WORDS_BIGENDIAN */ + #define cpu_to_le16(x) (x) #define cpu_to_le32(x) (x) #define cpu_to_le64(x) (x) #define cpu_to_be16(x) swab16(x) #define cpu_to_be32(x) swab32(x) #define cpu_to_be64(x) swab64(x) -#endif + +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) +#define be16_to_cpu(x) swab16(x) +#define be32_to_cpu(x) swab32(x) +#define be64_to_cpu(x) swab64(x) + +#endif /* !WORDS_BIGENDIAN */ #endif /* BITOPS_H */ -- 2.39.5