Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / tools / include / tools / endian.h
1 #ifndef _TOOLS_ENDIAN_H
2 #define _TOOLS_ENDIAN_H
3
4 #include <byteswap.h>
5
6 #if __BYTE_ORDER == __LITTLE_ENDIAN
7
8 #ifndef htole16
9 #define htole16(x) (x)
10 #endif
11 #ifndef htole32
12 #define htole32(x) (x)
13 #endif
14 #ifndef htole64
15 #define htole64(x) (x)
16 #endif
17
18 #ifndef le16toh
19 #define le16toh(x) (x)
20 #endif
21
22 #ifndef le32toh
23 #define le32toh(x) (x)
24 #endif
25
26 #ifndef le64toh
27 #define le64toh(x) (x)
28 #endif
29
30 #else /* __BYTE_ORDER */
31
32 #ifndef htole16
33 #define htole16(x) __bswap_16(x)
34 #endif
35 #ifndef htole32
36 #define htole32(x) __bswap_32(x)
37 #endif
38 #ifndef htole64
39 #define htole64(x) __bswap_64(x)
40 #endif
41
42 #ifndef le16toh
43 #define le16toh(x) __bswap_16(x)
44 #endif
45
46 #ifndef le32toh
47 #define le32toh(x) __bswap_32(x)
48 #endif
49
50 #ifndef le64toh
51 #define le64toh(x) __bswap_64(x)
52 #endif
53
54 #endif
55
56 #endif /* _TOOLS_ENDIAN_H */