diff options
author | Christian Heimes <christian@cheimes.de> | 2012-10-17 23:52:17 +0200 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2012-10-17 23:52:17 +0200 |
commit | 743e0cd6b5d59767aae2524700857f188ca1e80e (patch) | |
tree | 89897c0424a3b361e04d451e2b3a64e5c7c17756 /Modules/_sha3 | |
parent | merge heads (diff) | |
download | cpython-743e0cd6b5d59767aae2524700857f188ca1e80e.tar.gz cpython-743e0cd6b5d59767aae2524700857f188ca1e80e.tar.bz2 cpython-743e0cd6b5d59767aae2524700857f188ca1e80e.zip |
Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
endianess detection and handling.
Diffstat (limited to 'Modules/_sha3')
-rwxr-xr-x | Modules/_sha3/cleanup.py | 8 | ||||
-rw-r--r-- | Modules/_sha3/keccak/KeccakF-1600-opt32.c | 2 | ||||
-rw-r--r-- | Modules/_sha3/keccak/KeccakF-1600-opt64.c | 2 | ||||
-rw-r--r-- | Modules/_sha3/sha3module.c | 13 |
4 files changed, 14 insertions, 11 deletions
diff --git a/Modules/_sha3/cleanup.py b/Modules/_sha3/cleanup.py index 5238ab3ca9d..aabcb0442ce 100755 --- a/Modules/_sha3/cleanup.py +++ b/Modules/_sha3/cleanup.py @@ -32,10 +32,10 @@ def cleanup(f): if line.startswith("typedef unsigned long long int"): buf.append("/* %s */\n" % line.strip()) continue - ## remove #include "brg_endian.h" - #if "brg_endian.h" in line: - # buf.append("/* %s */\n" % line.strip()) - # continue + # remove #include "brg_endian.h" + if "brg_endian.h" in line: + buf.append("/* %s */\n" % line.strip()) + continue # transform C++ comments into ANSI C comments line = CPP1.sub(r"/* \1 */", line) line = CPP2.sub(r" /* \1 */", line) diff --git a/Modules/_sha3/keccak/KeccakF-1600-opt32.c b/Modules/_sha3/keccak/KeccakF-1600-opt32.c index 473dde5d9a7..dba6d59f134 100644 --- a/Modules/_sha3/keccak/KeccakF-1600-opt32.c +++ b/Modules/_sha3/keccak/KeccakF-1600-opt32.c @@ -12,7 +12,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ #include <string.h> -#include "brg_endian.h" +/* #include "brg_endian.h" */ #include "KeccakF-1600-opt32-settings.h" #include "KeccakF-1600-interface.h" diff --git a/Modules/_sha3/keccak/KeccakF-1600-opt64.c b/Modules/_sha3/keccak/KeccakF-1600-opt64.c index 57e2aa45009..f19b18b36ac 100644 --- a/Modules/_sha3/keccak/KeccakF-1600-opt64.c +++ b/Modules/_sha3/keccak/KeccakF-1600-opt64.c @@ -12,7 +12,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ #include <string.h> -#include "brg_endian.h" +/* #include "brg_endian.h" */ #include "KeccakF-1600-opt64-settings.h" #include "KeccakF-1600-interface.h" diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c index 08f683934b1..4c3c6db1322 100644 --- a/Modules/_sha3/sha3module.c +++ b/Modules/_sha3/sha3module.c @@ -124,11 +124,14 @@ #define UseInterleaveTables #endif -/* replacement for brg_endian.h -#define IS_BIG_ENDIAN BIG_ENDIAN -#define IS_LITTLE_ENDIAN LITTLE_ENDIAN -#define PLATFORM_BYTE_ORDER BYTE_ORDER -*/ +/* replacement for brg_endian.h */ +#define IS_BIG_ENDIAN 4321 +#define IS_LITTLE_ENDIAN 1234 +#if PY_BIG_ENDIAN +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#else +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#endif /* inline all Keccak dependencies */ #include "keccak/KeccakNISTInterface.h" |