Old glibc doesn't provide these macros, so we have to define them.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
Joe Thornber 2015-01-16 10:12:30 +00:00
parent 8e92158055
commit dd9bd206c6

View File

@ -25,6 +25,26 @@
//----------------------------------------------------------------
/* An old glic doesn't provide these macros */
#if !defined(htole16) || !defined(le16toh) || !defined(htole32) || !defined(le32toh) || !defined(htole64) || !defined(le64toh)
#include <byteswap.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htole16(x) (x)
#define le16toh(x) (x)
#define htole32(x) (x)
#define le32toh(x) (x)
#define htole64(x) (x)
#define le64toh(x) (x)
#else
#define htole16(x) __bswap_16(x)
#define le16toh(x) __bswap_16(x)
#define htole32(x) __bswap_32(x)
#define le32toh(x) __bswap_32(x)
#define htole64(x) __bswap_64(x)
#define le64toh(x) __bswap_64(x)
#endif
#endif
namespace base {
// These are just little wrapper types to make the compiler