From: David Reiss Date: Wed, 18 Mar 2009 23:14:13 +0000 (+0000) Subject: THRIFT-362. python: Detect endianness on Solaris X-Git-Tag: 0.2.0~259 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=4980910100f67b1353040529257825af946f8e6b;p=common%2Fthrift.git THRIFT-362. python: Detect endianness on Solaris git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755776 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/py/src/protocol/fastbinary.c b/lib/py/src/protocol/fastbinary.c index 7ada44c6..71c0f8d4 100644 --- a/lib/py/src/protocol/fastbinary.c +++ b/lib/py/src/protocol/fastbinary.c @@ -16,6 +16,25 @@ #include #include +/* Fix endianness issues on Solaris */ +#if defined (__SVR4) && defined (__sun) + #if defined(__i386) && !defined(__i386__) + #define __i386__ + #endif + + #ifndef BIG_ENDIAN + #define BIG_ENDIAN (4321) + #endif + #ifndef LITTLE_ENDIAN + #define LITTLE_ENDIAN (1234) + #endif + + /* I386 is LE, even on Solaris */ + #if !defined(BYTE_ORDER) && defined(__i386__) + #define BYTE_ORDER LITTLE_ENDIAN + #endif +#endif + // TODO(dreiss): defval appears to be unused. Look into removing it. // TODO(dreiss): Make parse_spec_args recursive, and cache the output // permanently in the object. (Malloc and orphan.)