diff options
| author | Peter Foley <pefoley2@pefoley.com> | 2014-09-25 14:23:32 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2014-09-26 05:02:58 -0400 |
| commit | 8c2b0dc83d9840da4d993a5dbb15c5974ad5a188 (patch) | |
| tree | d1750009baa6051f3aec12087baad8700af7e3b5 /tools/include | |
| parent | 19f94f97003a70a5241efff035f6c181c290a799 (diff) | |
Documentation: support glibc versions without htole macros
glibc 2.9 introduced the htole<16/32/64> macros, add them to
tools/include to support older versions of glibc.
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Peter Foley <pefoley2@pefoley.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'tools/include')
| -rw-r--r-- | tools/include/tools/endian.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/include/tools/endian.h b/tools/include/tools/endian.h new file mode 100644 index 000000000000..5d42e20ab83d --- /dev/null +++ b/tools/include/tools/endian.h | |||
| @@ -0,0 +1,32 @@ | |||
| 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 | #else /* __BYTE_ORDER */ | ||
| 19 | |||
| 20 | #ifndef htole16 | ||
| 21 | #define htole16(x) __bswap_16(x) | ||
| 22 | #endif | ||
| 23 | #ifndef htole32 | ||
| 24 | #define htole32(x) __bswap_32(x) | ||
| 25 | #endif | ||
| 26 | #ifndef htole64 | ||
| 27 | #define htole64(x) __bswap_64(x) | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #endif | ||
| 31 | |||
| 32 | #endif /* _TOOLS_ENDIAN_H */ | ||
