Commit c3e92802 authored by Kal Conley's avatar Kal Conley

Improved little endian byte order detection

Including <sys/param.h> on Mac/iOS doesn't define __BYTE_ORDER so
PROTOBUF_LITTLE_ENDIAN was never being defined. This commit adds a check
for the __LITTLE_ENDIAN__ macro which is defined by clang and Apple gcc on
little endian architectures.
parent 59692c3f
......@@ -123,7 +123,8 @@
#endif
#else
#include <sys/param.h> // __BYTE_ORDER
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && \
#if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
#define PROTOBUF_LITTLE_ENDIAN 1
#endif
......
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