Commit 2e54b1be authored by Ondřej Surý's avatar Ondřej Surý Committed by Michał Kępień

Make <isc/endian.h> detect GNU rather than Linux

Instead of only supporting Linux, try making <isc/endian.h> support
other GNU platforms as well.  Since some compilers define __GNUC__ on
BSDs (e.g. Clang on FreeBSD), move the relevant section to the bottom of
the platform-specific part of <isc/endian.h>, so that it only gets
evaluated when more specific platform determination criteria are not
met.  Also include <byteswap.h> so that any byte-swapping macros which
may be defined in that file on older platforms are used in the fallback
definitions of the nonstandard hto[bl]e{16,32,64}() and
[bl]e{16,32,64}toh() conversion functions.
parent 387cc001
......@@ -11,11 +11,7 @@
#pragma once
#if defined(__linux__) || defined(__CYGWIN__)
#include <endian.h>
#elif defined __APPLE__
#if defined __APPLE__
#include <libkern/OSByteOrder.h>
......@@ -96,6 +92,12 @@
# define bswap_32(x) BSWAP_32(x)
# define bswap_64(x) BSWAP_64(x)
#elif defined(__ANDROID__) || defined(__CYGWIN__) || \
defined(__GNUC__) || defined(__GNU__)
# include <byteswap.h>
# include <endian.h>
#else
#endif /* Specific platform support */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment