From: David Reiss Date: Tue, 17 Feb 2009 20:06:08 +0000 (+0000) Subject: THRIFT-340. python: Detect endianness properly on FreeBSD X-Git-Tag: 0.2.0~302 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=fdd8b5ab013be680eca7d6a241e6ebb39be0ff7c;p=common%2Fthrift.git THRIFT-340. python: Detect endianness properly on FreeBSD git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745223 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/py/src/protocol/fastbinary.c b/lib/py/src/protocol/fastbinary.c index 0945ca76..7ada44c6 100644 --- a/lib/py/src/protocol/fastbinary.c +++ b/lib/py/src/protocol/fastbinary.c @@ -50,6 +50,16 @@ typedef enum TType { T_UTF16 = 17 } TType; +#ifndef __BYTE_ORDER +# if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN +# else +# error "Cannot determine endianness" +# endif +#endif + // Same comment as the enum. Sorry. #if __BYTE_ORDER == __BIG_ENDIAN # define ntohll(n) (n)