Skip to content

Commit 76924d1

Browse files
committed
Change PYLONG_BITS_IN_DIGIT default to 30
1 parent 5c66414 commit 76924d1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Include/pyport.h

+5-12
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,13 @@ Used in: Py_SAFE_DOWNCAST
8585
#define PY_INT32_T int32_t
8686
#define PY_INT64_T int64_t
8787

88-
/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
89-
the necessary integer types are available, and we're on a 64-bit platform
90-
(as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits.
91-
92-
From pyodide: WASM has 32 bit pointers but has native 64 bit arithmetic
93-
so it is more efficient to use 30 bit digits.
88+
/* PYLONG_BITS_IN_DIGIT describes the number of bits per "digit" (limb) in the
89+
* PyLongObject implementation (longintrepr.h). It's currently either 30 or 15,
90+
* defaulting to 30. The 15-bit PyLong digit option may be removed in the
91+
* future.
9492
*/
95-
9693
#ifndef PYLONG_BITS_IN_DIGIT
97-
#if SIZEOF_VOID_P >= 8 || defined(__wasm__)
98-
# define PYLONG_BITS_IN_DIGIT 30
99-
#else
100-
# define PYLONG_BITS_IN_DIGIT 15
101-
#endif
94+
#define PYLONG_BITS_IN_DIGIT 30
10295
#endif
10396

10497
/* uintptr_t is the C9X name for an unsigned integral type such that a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The build now defaults to using 30-bit digits for Python integers. Previously
2+
either 15-bit or 30-bit digits would be selected, depending on the platform.
3+
15-bit digits may still be selected using the ``--enable-big-digits=15`` option
4+
to the ``configure`` script, or by defining ``PYLONG_BITS_IN_DIGIT`` in
5+
``pyconfig.h``.

0 commit comments

Comments
 (0)