From fdd8b5ab013be680eca7d6a241e6ebb39be0ff7c Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 17 Feb 2009 20:06:08 +0000 Subject: [PATCH] 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 --- lib/py/src/protocol/fastbinary.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) -- 2.17.1