bpo-40280: Optimize ints and and startup on wasm (GH-29887) by tiran · Pull Request #29887 · python/cpython
Expand Up
@@ -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
Expand Down
/* 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
Expand Down