diff options
author | Tobias Brunner <tobias@strongswan.org> | 2016-03-31 19:47:31 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2016-03-31 19:47:31 +0200 |
commit | 90c8cf6819a9d68ba945beb02a03ee52364c3a74 (patch) | |
tree | fe4a01d09872f8c8719e0d82b3a920151cdb3ab4 /src | |
parent | be41d5cba2ff03e2b8157a3b607a2b7921de1899 (diff) | |
download | strongswan-90c8cf6819a9d68ba945beb02a03ee52364c3a74.tar.bz2 strongswan-90c8cf6819a9d68ba945beb02a03ee52364c3a74.tar.xz |
byteorder: Explicitly check for htoXeXX macros
Some platforms have XetohXX macros instead of XeXXtoh macros, in which
case we'd redefine the htoXeXX macros.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/utils/byteorder.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libstrongswan/utils/utils/byteorder.h b/src/libstrongswan/utils/utils/byteorder.h index 1072a0e6e..7c7e53420 100644 --- a/src/libstrongswan/utils/utils/byteorder.h +++ b/src/libstrongswan/utils/utils/byteorder.h @@ -47,9 +47,14 @@ #ifndef le32toh # if BYTE_ORDER == BIG_ENDIAN # define le32toh(x) __builtin_bswap32(x) -# define htole32(x) __builtin_bswap32(x) # else # define le32toh(x) (x) +# endif +#endif +#ifndef htole32 +# if BYTE_ORDER == BIG_ENDIAN +# define htole32(x) __builtin_bswap32(x) +# else # define htole32(x) (x) # endif #endif @@ -57,9 +62,14 @@ #ifndef le64toh # if BYTE_ORDER == BIG_ENDIAN # define le64toh(x) __builtin_bswap64(x) -# define htole64(x) __builtin_bswap64(x) # else # define le64toh(x) (x) +# endif +#endif +#ifndef htole64 +# if BYTE_ORDER == BIG_ENDIAN +# define htole64(x) __builtin_bswap64(x) +# else # define htole64(x) (x) # endif #endif @@ -67,9 +77,14 @@ #ifndef be64toh # if BYTE_ORDER == BIG_ENDIAN # define be64toh(x) (x) -# define htobe64(x) (x) # else # define be64toh(x) __builtin_bswap64(x) +# endif +#endif +#ifndef htobe64 +# if BYTE_ORDER == BIG_ENDIAN +# define htobe64(x) (x) +# else # define htobe64(x) __builtin_bswap64(x) # endif #endif |