]> err.no Git - util-linux/commitdiff
include: add bitops.h with swab{16,32,64} macros
authorKarel Zak <kzak@redhat.com>
Mon, 17 Dec 2007 12:18:12 +0000 (13:18 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 17 Dec 2007 12:41:13 +0000 (13:41 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/bitops.h

index 4ae0ff8e4b2f28f3b46fad335ef0e07885929038..7b2b17e75cfa5c5dd16d8b11f847f64ad495a327 100644 (file)
 
 
 #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 */