diff options
author | Christian Heimes <christian@python.org> | 2021-12-02 11:19:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 11:19:30 (GMT) |
commit | cb8f491f46e262549f6c447b31625cab7c20a60a (patch) | |
tree | a476521e1a746f42667312ceb8dd9866feb9654e /Include | |
parent | a6c3b0faa1d55e36539caf19bd3bcf1dea12df84 (diff) | |
download | cpython-cb8f491f46e262549f6c447b31625cab7c20a60a.zip cpython-cb8f491f46e262549f6c447b31625cab7c20a60a.tar.gz cpython-cb8f491f46e262549f6c447b31625cab7c20a60a.tar.bz2 |
bpo-40280: Optimize ints and and startup on wasm (GH-29887)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pyport.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index 953f75c..81b1bde 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -87,13 +87,17 @@ Used in: Py_SAFE_DOWNCAST /* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all the necessary integer types are available, and we're on a 64-bit platform - (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ + (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. + + From pyodide: WASM has 32 bit pointers but has native 64 bit arithmetic + so it is more efficient to use 30 bit digits. + */ #ifndef PYLONG_BITS_IN_DIGIT -#if SIZEOF_VOID_P >= 8 -#define PYLONG_BITS_IN_DIGIT 30 +#if SIZEOF_VOID_P >= 8 || defined(__wasm__) +# define PYLONG_BITS_IN_DIGIT 30 #else -#define PYLONG_BITS_IN_DIGIT 15 +# define PYLONG_BITS_IN_DIGIT 15 #endif #endif |