summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2002-05-21 12:37:07 +0000
committerAlasdair Kergon <agk@redhat.com>2002-05-21 12:37:07 +0000
commiteff96d839e0754b9c42f38b1fd8c2a19328cd2e9 (patch)
tree0f302a13745aada0860dceefeb8d20b47f728857
parentaa34c238071343ffdea791f899fb3cda21036618 (diff)
downloadlvm2-eff96d839e0754b9c42f38b1fd8c2a19328cd2e9.tar.gz
Revert to standard linux macros (for correct behaviour on rare architectures).old-beta3beta3
-rw-r--r--lib/mm/xlate.h46
1 files changed, 5 insertions, 41 deletions
diff --git a/lib/mm/xlate.h b/lib/mm/xlate.h
index a0c9d35a9..a72e6fe98 100644
--- a/lib/mm/xlate.h
+++ b/lib/mm/xlate.h
@@ -1,53 +1,17 @@
/*
* Copyright (C) 2001 Sistina Software (UK) Limited.
*
- * This file is released under the GPL.
+ * This file is released under the LGPL.
*
*/
#ifndef _LVM_XLATE_H
#define _LVM_XLATE_H
-#include <stdlib.h>
-#include <stdint.h>
+#include <asm/byteorder.h>
-#if __BYTE_ORDER == __BIG_ENDIAN
-
-static inline uint16_t swab16(uint16_t x)
-{
- return (x & 0x00ffU) << 8 |
- (x & 0xff00U) >> 8;
-}
-
-static inline uint32_t swab32(uint32_t x)
-{
- return (x & 0x000000ffU) << 24 |
- (x & 0x0000ff00U) << 8 |
- (x & 0x00ff0000U) >> 8 |
- (x & 0xff000000U) >> 24;
-}
-
-static inline uint64_t swab64(uint64_t x)
-{
- return (x & 0x00000000000000ffULL) << 56 |
- (x & 0x000000000000ff00ULL) << 40 |
- (x & 0x0000000000ff0000ULL) << 24 |
- (x & 0x00000000ff000000ULL) << 8 |
- (x & 0x000000ff00000000ULL) >> 8 |
- (x & 0x0000ff0000000000ULL) >> 24 |
- (x & 0x00ff000000000000ULL) >> 40 |
- (x & 0xff00000000000000ULL) >> 56;
-}
-
-# define xlate16(x) swab16((x))
-# define xlate32(x) swab32((x))
-# define xlate64(x) swab64((x))
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-# define xlate16(x) (x)
-# define xlate32(x) (x)
-# define xlate64(x) (x)
-#else
-# error "__BYTE_ORDER must be defined as __LITTLE_ENDIAN or __BIG_ENDIAN"
-#endif
+#define xlate16(x) __cpu_to_le16((x));
+#define xlate32(x) __cpu_to_le32((x));
+#define xlate64(x) __cpu_to_le64((x));
#endif