2
* Copyright (C) 2004,2005 Heinz Mauelshagen, Red Hat GmbH.
5
* See file LICENSE at the top of this source tree for license information.
17
#ifdef DM_BYTEORDER_SWAB
19
static inline uint64_t
20
le64_to_cpu(uint64_t x)
22
return ((((uint64_t) x & 0x00000000000000ffULL) << 56) |
23
(((uint64_t) x & 0x000000000000ff00ULL) << 40) |
24
(((uint64_t) x & 0x0000000000ff0000ULL) << 24) |
25
(((uint64_t) x & 0x00000000ff000000ULL) << 8) |
26
(((uint64_t) x & 0x000000ff00000000ULL) >> 8) |
27
(((uint64_t) x & 0x0000ff0000000000ULL) >> 24) |
28
(((uint64_t) x & 0x00ff000000000000ULL) >> 40) |
29
(((uint64_t) x & 0xff00000000000000ULL) >> 56));
33
le32_to_cpu(int32_t x)
35
return ((((u_int32_t) x & 0x000000ffU) << 24) |
36
(((u_int32_t) x & 0x0000ff00U) << 8) |
37
(((u_int32_t) x & 0x00ff0000U) >> 8) |
38
(((u_int32_t) x & 0xff000000U) >> 24));
42
le16_to_cpu(int16_t x)
44
return ((((u_int16_t) x & 0x00ff) << 8) |
45
(((u_int16_t) x & 0xff00) >> 8));
48
#define CVT64(x) do { x = le64_to_cpu(x); } while(0)
49
#define CVT32(x) do { x = le32_to_cpu(x); } while(0)
50
#define CVT16(x) do { x = le16_to_cpu(x); } while(0)
58
#undef DM_BYTEORDER_SWAB
60
#endif /* #ifdef DM_BYTEORDER_SWAB */