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 | 114c42641335bdc26cbf61c18c82b0f5c8a6d4f8 (patch) | |
tree | 2b1730bb73e98cc0198ee1ea35c4afd8ba8287d7 /Modules/_sha3 | |
parent | 79ca8edc5b262cea550f10b231ab8eba90b267f3 (diff) | |
download | cpython-114c42641335bdc26cbf61c18c82b0f5c8a6d4f8.tar.gz |
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 5238ab3ca9..aabcb0442c 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 473dde5d9a..dba6d59f13 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 57e2aa4500..f19b18b36a 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 08f683934b..4c3c6db132 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" |