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:
parent
8e92158055
commit
dd9bd206c6
@ -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 {
|
namespace base {
|
||||||
|
|
||||||
// These are just little wrapper types to make the compiler
|
// These are just little wrapper types to make the compiler
|
||||||
|
Loading…
Reference in New Issue
Block a user