mirror of
https://github.com/python/cpython.git
synced 2025-07-12 22:05:16 +00:00
gh-127119: Faster check for small ints in long_dealloc (GH-127620)
This commit is contained in:
parent
3a974e39d5
commit
a29221675e
6 changed files with 48 additions and 45 deletions
|
@ -890,7 +890,7 @@ class PyLongObjectPtr(PyObjectPtr):
|
|||
|
||||
def proxyval(self, visited):
|
||||
'''
|
||||
Python's Include/longinterpr.h has this declaration:
|
||||
Python's Include/cpython/longinterpr.h has this declaration:
|
||||
|
||||
typedef struct _PyLongValue {
|
||||
uintptr_t lv_tag; /* Number of digits, sign and flags */
|
||||
|
@ -909,8 +909,7 @@ class PyLongObjectPtr(PyObjectPtr):
|
|||
- 0: Positive
|
||||
- 1: Zero
|
||||
- 2: Negative
|
||||
The third lowest bit of lv_tag is reserved for an immortality flag, but is
|
||||
not currently used.
|
||||
The third lowest bit of lv_tag is set to 1 for the small ints and 0 otherwise.
|
||||
|
||||
where SHIFT can be either:
|
||||
#define PyLong_SHIFT 30
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue