[Python-checkins] cpython: Force 32bit Keccak implementation on SPARC. It look like the Solaris CC
christian.heimes
python-checkins at python.org
Sun Oct 14 02:53:51 CEST 2012
http://hg.python.org/cpython/rev/b397b0c08f69
changeset: 79717:b397b0c08f69
parent: 79715:3465ef48d0f5
user: Christian Heimes <christian at cheimes.de>
date: Sun Oct 14 02:52:01 2012 +0200
summary:
Force 32bit Keccak implementation on SPARC. It look like the Solaris CC compiler doesn't like the address alignment.
files:
Modules/_sha3/sha3module.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -95,21 +95,27 @@
*
* *************************************************************************/
-#if SIZEOF_VOID_P == 8 && defined(PY_UINT64_T)
- /* 64bit platforms with unsigned int64 */
- #define KeccakImplementation 64
+#ifdef __sparc
+ /* On SPARC with Solaris CC opt64 fails with 'invalid address alignment' */
+ #define KeccakOpt 32
+#elif SIZEOF_VOID_P == 8
+ #define KeccakOpt 64
+#elif SIZEOF_VOID_P == 4
+ #define KeccakOpt 32
+#endif
+
+#if KeccakOpt == 64 && defined(PY_UINT64_T)
+ /* 64bit platforms with unsigned int64 */
#define Unrolling 24
#define UseBebigokimisa
typedef PY_UINT64_T UINT64;
-#elif SIZEOF_VOID_P == 4 && defined(PY_UINT64_T)
+#elif KeccakOpt == 32 && defined(PY_UINT64_T)
/* 32bit platforms with unsigned int64 */
- #define KeccakImplementation 32
#define Unrolling 2
#define UseSchedule 3
typedef PY_UINT64_T UINT64;
#else
/* 32 or 64bit platforms without unsigned int64 */
- #define KeccakImplementation 32
#define Unrolling 2
#define UseSchedule 3
#define UseInterleaveTables
@@ -125,9 +131,9 @@
#include "keccak/KeccakNISTInterface.h"
#include "keccak/KeccakNISTInterface.c"
#include "keccak/KeccakSponge.c"
-#if KeccakImplementation == 64
+#if KeccakOpt == 64
#include "keccak/KeccakF-1600-opt64.c"
-#elif KeccakImplementation == 32
+#elif KeccakOpt == 32
#include "keccak/KeccakF-1600-opt32.c"
#endif
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list