Commit bb584420 authored by bwelling's avatar bwelling Committed by Wouter van Oortmerssen

Improve endian detection. (#5204)

Add support for using __BYTE_ORDER__, to support platforms where g++
doesn't explicitly define __BIG_ENDIAN__, like Solaris Sparc.
parent 4567b131
...@@ -118,7 +118,8 @@ ...@@ -118,7 +118,8 @@
#endif // __s390x__ #endif // __s390x__
#if !defined(FLATBUFFERS_LITTLEENDIAN) #if !defined(FLATBUFFERS_LITTLEENDIAN)
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#ifdef __BIG_ENDIAN__ #if (defined(__BIG_ENDIAN__) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
#define FLATBUFFERS_LITTLEENDIAN 0 #define FLATBUFFERS_LITTLEENDIAN 0
#else #else
#define FLATBUFFERS_LITTLEENDIAN 1 #define FLATBUFFERS_LITTLEENDIAN 1
......
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