]> sourceware.org Git - lvm2.git/commitdiff
Restructure xlate.h
authorAlasdair Kergon <agk@redhat.com>
Thu, 2 Sep 2004 13:53:25 +0000 (13:53 +0000)
committerAlasdair Kergon <agk@redhat.com>
Thu, 2 Sep 2004 13:53:25 +0000 (13:53 +0000)
WHATS_NEW
lib/mm/xlate.h

index 2620be1c9ce3440a20985002f823cde7db72fc1f..e846f76d8c4f5b24b4aaf5c9d4bc627a6ba99bd7 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.00.22 - 
 ==================================
+  Restructure xlate.h
 
 Version 2.00.21 - 19th August 2004
 ==================================
index 65ae91ddda06a343a9542792359c1e832c240165..8ba9ef7daa05f26a571300a7e9c0829272695393 100644 (file)
 #define _LVM_XLATE_H
 
 #ifdef linux
+#  include <endian.h>
+#  include <byteswap.h>
+#else
+#  include <machine/endian.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) & 0x00000000000000ffU) << 56 | \
+                      ((x) & 0xff00000000000000U) >> 56 | \
+                      ((x) & 0x000000000000ff00U) << 40 | \
+                      ((x) & 0x00ff000000000000U) >> 40 | \
+                      ((x) & 0x0000000000ff0000U) << 24 | \
+                      ((x) & 0x0000ff0000000000U) >> 24 | \
+                      ((x) & 0x00000000ff000000U) << 8 | \
+                      ((x) & 0x000000ff00000000U) >> 8)
+#endif
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#  define xlate16(x) (x)
+#  define xlate32(x) (x)
+#  define xlate64(x) (x)
+#  define xlate16_be(x) bswap_16(x)
+#  define xlate32_be(x) bswap_32(x)
+#  define xlate64_be(x) bswap_64(x)
+#elif BYTE_ORDER == BIG_ENDIAN
+#  define xlate16(x) bswap_16(x)
+#  define xlate32(x) bswap_32(x)
+#  define xlate64(x) bswap_64(x)
+#  define xlate16_be(x) (x)
+#  define xlate32_be(x) (x)
+#  define xlate64_be(x) (x)
+#else
 #  include <asm/byteorder.h>
 #  define xlate16(x) __cpu_to_le16((x))
 #  define xlate32(x) __cpu_to_le32((x))
 #  define xlate16_be(x) __cpu_to_be16((x))
 #  define xlate32_be(x) __cpu_to_be32((x))
 #  define xlate64_be(x) __cpu_to_be64((x))
-#else
-#  include <machine/endian.h>
-#  if !defined(BYTE_ORDER) || \
-      (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN)
-#    error "Undefined or unrecognised BYTE_ORDER";
-#  endif
-#  define __xlate16(x) (((x) & 0x00ffU) << 8 | \
-                       ((x) & 0xff00U) >> 8)
-#  define __xlate32(x) (((x) & 0x000000ffU) << 24 | \
-                       ((x) & 0xff000000U) >> 24 | \
-                       ((x) & 0x0000ff00U) << 8  | \
-                       ((x) & 0x00ff0000U) >> 8)
-#  define __xlate64(x) (((x) & 0x00000000000000ffU) << 56 | \
-                       ((x) & 0xff00000000000000U) >> 56 | \
-                       ((x) & 0x000000000000ff00U) << 40 | \
-                       ((x) & 0x00ff000000000000U) >> 40 | \
-                       ((x) & 0x0000000000ff0000U) << 24 | \
-                       ((x) & 0x0000ff0000000000U) >> 24 | \
-                       ((x) & 0x00000000ff000000U) << 8 | \
-                       ((x) & 0x000000ff00000000U) >> 8)
-#  if BYTE_ORDER == LITTLE_ENDIAN
-#    define xlate16(x) (x)
-#    define xlate32(x) (x)
-#    define xlate64(x) (x)
-#    define xlate16_be(x) __xlate16(x)
-#    define xlate32_be(x) __xlate32(x)
-#    define xlate64_be(x) __xlate64(x)
-#  else
-#    define xlate16(x) __xlate16(x)
-#    define xlate32(x) __xlate32(x)
-#    define xlate64(x) __xlate64(x)
-#    define xlate16_be(x) (x)
-#    define xlate32_be(x) (x)
-#    define xlate64_be(x) (x)
-#  endif
 #endif
 
 #endif
This page took 0.0683280000000001 seconds and 5 git commands to generate.