[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

Christian Heimes report at bugs.python.org
Mon Oct 8 16:33:27 CEST 2012


New submission from Christian Heimes:

I propose the addition of three new macros in pyport.h

#define PY_LITTLE_ENDIAN 1234
#define PY_BIG_ENDIAN 4321
#define PY_BYTE_ORDER <either little or big endian>

that are either set by a configure test or implemented like brg_endian.h. pyconfig.h has WORDS_BIGENDIAN which just checks for __BIG_ENDIAN__. The sysmodule has its own C code that checks the first byte of a long to detect the endianess.

http://hg.python.org/cpython/file/dd5e98ddcd39/Modules/_sha3/keccak/brg_endian.h

I'd like to remove Keccak's brg_endian.h (#16113 SHA-3 module) for something more official and useful to other code. I had to re-add the file because the tests were failing on a big endian Solaris (Sparc) machine.

----------
components: Build
messages: 172381
nosy: christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: Add PY_BYTE_ORDER macro to get endianess of platform
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16166>
_______________________________________


More information about the Python-bugs-list mailing list