2 Copyright Red Hat, Inc. 2002-2003
4 The Red Hat Cluster Manager API Library is free software; you can
5 redistribute it and/or modify it under the terms of the GNU Lesser
6 General Public License as published by the Free Software Foundation;
7 either version 2.1 of the License, or (at your option) any later
10 The Red Hat Cluster Manager API Library is distributed in the hope
11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * Defines for byte-swapping
27 #include <sys/param.h>
29 #include <bits/wordsize.h>
32 /* No swapping on little-endian machines */
33 #if __BYTE_ORDER == __LITTLE_ENDIAN
34 #define le_swap16(x) (x)
35 #define le_swap32(x) (x)
36 #define le_swap64(x) (x)
38 #define le_swap16(x) bswap_16(x)
39 #define le_swap32(x) bswap_32(x)
40 #define le_swap64(x) bswap_64(x)
43 /* No swapping on big-endian machines */
44 #if __BYTE_ORDER == __LITTLE_ENDIAN
45 #define be_swap16(x) bswap_16(x)
46 #define be_swap32(x) bswap_32(x)
47 #define be_swap64(x) bswap_64(x)
49 #define be_swap16(x) (x)
50 #define be_swap32(x) (x)
51 #define be_swap64(x) (x)
55 #define swab16(x) x=be_swap16(x)
56 #define swab32(x) x=be_swap32(x)
57 #define swab64(x) x=be_swap64(x)
61 #define ptrcast_uint64_t(ptr) ((uint64_t)((uint32_t)ptr))
64 #define ptrcast_uint64_t(ptr) ((uint64_t)ptr)
66 #error "Unsupported architecture!"
71 #endif /* __PLATFORM_H */