From: Robert Bradshaw Date: Sat, 2 Aug 2008 21:49:42 +0000 (-0700) Subject: Remove dependancy on endian.h (which is not available on all systems) X-Git-Tag: 0.9.8.1~105 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=72b9b9084278dd8f8dc6799779cdf849158ca627;p=cython.git Remove dependancy on endian.h (which is not available on all systems) --- diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index 3e8f5ac4..59e63165 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -29,8 +29,6 @@ class IntroduceBufferAuxiliaryVars(CythonTransform): self.max_ndim = 0 result = super(IntroduceBufferAuxiliaryVars, self).__call__(node) if self.buffers_exists: - if "endian.h" not in node.scope.include_files: - node.scope.include_files.append("endian.h") use_py2_buffer_functions(node.scope) use_empty_bufstruct_code(node.scope, self.max_ndim) node.scope.use_utility_code(access_utility_code) @@ -656,18 +654,20 @@ static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) { } static INLINE const char* __Pyx_BufferTypestringCheckEndian(const char* ts) { + int num = 1; + int little_endian = ((char*)&num)[0]; int ok = 1; switch (*ts) { case '@': case '=': ++ts; break; case '<': - if (__BYTE_ORDER == __LITTLE_ENDIAN) ++ts; + if (little_endian) ++ts; else ok = 0; break; case '>': case '!': - if (__BYTE_ORDER == __BIG_ENDIAN) ++ts; + if (!little_endian) ++ts; else ok = 0; break; }