From: Roy Marples Date: Mon, 18 Jul 2016 13:13:40 +0000 (+0000) Subject: Fix BYTE_ORDER for Solaris which does not define it readily. X-Git-Tag: v6.11.2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df56fd2e3088f126151a9a43a68f0c9d14c13728;p=thirdparty%2Fdhcpcd.git Fix BYTE_ORDER for Solaris which does not define it readily. --- diff --git a/ipv4.h b/ipv4.h index 4def6361..cdc71a43 100644 --- a/ipv4.h +++ b/ipv4.h @@ -40,6 +40,18 @@ #undef HTONL #endif +#ifndef BYTE_ORDER +#define BIG_ENDIAN 1234 +#define LITTLE_ENDIAN 4321 +#if defined(_BIG_ENDIAN) +#define BYTE_ORDER BIG_ENDIAN +#elif defined(_LITTLE_ENDIAN) +#define BYTE_ORDER LITTLE_ENDIAN +#else +#error Endian unknown +#endif +#endif + #if BYTE_ORDER == BIG_ENDIAN #define HTONL(A) (A) #elif BYTE_ORDER == LITTLE_ENDIAN @@ -48,8 +60,6 @@ (((uint32_t)(A) & 0x00ff0000) >> 8) | \ (((uint32_t)(A) & 0x0000ff00) << 8) | \ (((uint32_t)(A) & 0x000000ff) << 24)) -#else -#error Endian unknown #endif /* BYTE_ORDER */ struct rt {