[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Instead of using macro values, I would rather define ONLY a single macro, > PY_LITTLE_ENDIAN or PY_BIG_ENDIAN. Time machine strikes back. #ifdef WORDS_BIGENDIAN -- ___ Python tracker

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-19 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Instead of using macro values, I would rather define ONLY a single macro, PY_LITTLE_ENDIAN or PY_BIG_ENDIAN. Far less error prone!. It is far fool-proof "#ifdef PY_LITTLE_ENDIAN" than "#if PY_LITTLE_ENDIAN". -- __

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I've replaced the macros with PY_BIG_ENDIAN or PY_LITTLE_ENDIAN. Both are > always defined and exactly one is set to 1, the other to 0. It looks like a joke. The programmer puts on the table by his bed two glasses. One with water, for the case of he will d

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-17 Thread Christian Heimes
Changes by Christian Heimes : -- resolution: -> fixed stage: commit review -> committed/rejected status: open -> closed ___ Python tracker ___ __

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset d2127cdec10e by Christian Heimes in branch 'default': Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified http://hg.python.org/cpython/rev/d2127cdec10e -- nosy: +python-dev ___ Python

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: Looks fine to me. I suppose you'll have to check the big endian buildbots. -- stage: needs patch -> commit review ___ Python tracker ___ ___

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-17 Thread Christian Heimes
Christian Heimes added the comment: I've replaced the macros with PY_BIG_ENDIAN or PY_LITTLE_ENDIAN. Both are always defined and exactly one is set to 1, the other to 0. -- Added file: http://bugs.python.org/file27603/endian2.patch ___ Python tracker

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: I would prefer if you yanked PY_LITTLE_ENDIAN_FLAG. We don't need two different ways to do it. -- ___ Python tracker ___ __

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-10 Thread Christian Heimes
Christian Heimes added the comment: The patch defines either PY_IS_BIG_ENDIAN or PY_IS_LITTLE_ENDIAN and sets PY_LITTLE_ENDIAN_FLAG to either 0 or 1 for some modules that require a boolean flag. -- Added file: http://bugs.python.org/file27513/endian.patch _

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Roumen Petrov
Roumen Petrov added the comment: As Victor point configure script already check for endian (macro AC_C_BIGENDIAN) but you should ask python OS X guru to review . Macro is not adjusted to python needs as action for universal build is not defined yet. The default is to define AC_APPLE_UNIVERSAL_

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread STINNER Victor
STINNER Victor added the comment: AC_C_BIGENDIAN -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Usually you need code for both alternatives. #ifdef WORDS_BIGENDIAN ... #else ... #endif What can be simpler? Of cause, using *two* macros is complicated. You need only one and second macros is unnecessary. -- __

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > Fine with me. Having three macros is pointless complication. > > Don't having two macros for one boolean value pointless complication too? No, since you need only one to get going. Either: #ifdef PY_LITTLE_ENDIAN ... or: #ifdef PY_BIG_ENDIAN ... So this

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Fine with me. Having three macros is pointless complication. Don't having two macros for one boolean value pointless complication too? -- ___ Python tracker __

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Christian Heimes
Christian Heimes added the comment: I think it's not enough as some platforms prefix/suffix the macros with dashes. The values must be compared to BYTE_ORDER iff the macro is defined. too. I've checked some machines of the Snakebite network and came up with this macro cascade: /* * The endia

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > If you prefer two macros instead of three then we should name them > PY_IS_LITTLE_ENDIAN and PY_IS_BIG_ENDIAN. Fine with me. Having three macros is pointless complication. > If I understand you correctly than we can't have a configure definition > and need m

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Ned Deily
Ned Deily added the comment: Christian: That's right because there is only one configure execution in the OS X universal builds and only compiler call per module just like a normal single-architecture unix build. Under the covers, the Apple compiler driver transparently makes multiple compile

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Christian Heimes
Christian Heimes added the comment: My proposal mimics the API of endian.h. It defines a BYTE_ORDER macro that is either equal to LITTLE_ENDIAN, BIG_ENDIAN or PDB_ENDIAN (aka mixed endian). I need it that way for Keccak but I can roll my own definitions if you prefer just two macros. If you p

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Ned Deily
Ned Deily added the comment: Just a reminder that we support configurations where there are both big-endian and little-endinan binaries in the *same* executable file: for example, Mac OS X 32-bit-only universal binaries (.so, .dylib, .exe) contain both i386 and ppc code in the same file. So a

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > Ouch, sounds confusing. I would rather have PY_LITTLE_ENDIAN defined only > > on little-endian machines and PY_BIG_ENDIAN only on big-endian machines. > > (and PY_BYTE_ORDER isn't necessary) > > Why use two complementary boolean variables for a single boolea

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Ouch, sounds confusing. I would rather have PY_LITTLE_ENDIAN defined only > on little-endian machines and PY_BIG_ENDIAN only on big-endian machines. > (and PY_BYTE_ORDER isn't necessary) Why use two complementary boolean variables for a single boolean value

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > #define PY_LITTLE_ENDIAN 1234 > #define PY_BIG_ENDIAN 4321 > #define PY_BYTE_ORDER Ouch, sounds confusing. I would rather have PY_LITTLE_ENDIAN defined only on little-endian machines and PY_BIG_ENDIAN only on big-endian machines. (and PY_BYTE_ORDER isn't nec

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: This doesn't depend on #16113 (quite the contrary). -- dependencies: -Add SHA-3 (Keccak) support ___ Python tracker ___ ___

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which removes some unnecessary defines and tests. -- keywords: +patch Added file: http://bugs.python.org/file27499/endianess_cleanup.patch ___ Python tracker

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree, it is worth bring order to work with endianess. We can get rod of BYTEORDER_IS_BIG_ENDIAN and BYTEORDER_IS_LITTLE_ENDIAN in Objects/unicodeobject.c, IS_LITTLE_ENDIAN in Objects/longobject.c, tests in other modules. I don't see the necessity in new m

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Christian Heimes
Changes by Christian Heimes : -- dependencies: +Add SHA-3 (Keccak) support nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list m

[issue16166] Add PY_BYTE_ORDER macro to get endianess of platform

2012-10-08 Thread Christian Heimes
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 that are either set by a configure test or implemented like brg_endian.h. pyconfig.h has WORDS_BIGENDIAN which just check