From 1f835295d8230dd0a77db0f09a7bf10d39cb36ec Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 21 May 2002 12:37:07 +0000 Subject: [PATCH] Revert to standard linux macros (for correct behaviour on rare architectures). --- lib/mm/xlate.h | 46 +++++----------------------------------------- 1 file 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 -#include +#include -#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