mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
Merge c9edd321f6 into f9704f1d84
This commit is contained in:
commit
6e3c18bd81
1 changed files with 14 additions and 14 deletions
|
|
@ -48,6 +48,16 @@ _Py_DECREF_INT(PyLongObject *op)
|
|||
_Py_DECREF_SPECIALIZED((PyObject *)op, _PyLong_ExactDealloc);
|
||||
}
|
||||
|
||||
static inline int
|
||||
/// Return 1 if the object is one of the immortal small ints
|
||||
_long_is_small_int(PyObject *op)
|
||||
{
|
||||
PyLongObject *long_object = (PyLongObject *)op;
|
||||
int is_small_int = (long_object->long_value.lv_tag & IMMORTALITY_BIT_MASK) != 0;
|
||||
assert((!is_small_int) || PyLong_CheckExact(op));
|
||||
return is_small_int;
|
||||
}
|
||||
|
||||
static inline int
|
||||
is_medium_int(stwodigits x)
|
||||
{
|
||||
|
|
@ -344,8 +354,6 @@ medium_from_stwodigits(stwodigits x)
|
|||
}
|
||||
|
||||
|
||||
/* If a freshly-allocated int is already shared, it must
|
||||
be a small integer, so negating it must go to PyLong_FromLong */
|
||||
Py_LOCAL_INLINE(void)
|
||||
_PyLong_Negate(PyLongObject **x_p)
|
||||
{
|
||||
|
|
@ -357,8 +365,10 @@ _PyLong_Negate(PyLongObject **x_p)
|
|||
return;
|
||||
}
|
||||
|
||||
*x_p = _PyLong_FromSTwoDigits(-medium_value(x));
|
||||
Py_DECREF(x);
|
||||
/* If a freshly-allocated int is already shared, it must
|
||||
be a small integer, so negating it will fit a single digit */
|
||||
assert(_long_is_small_int((PyObject *)x));
|
||||
*x_p = (PyLongObject *)_PyLong_FromSTwoDigits(-medium_value(x));
|
||||
}
|
||||
|
||||
#define PYLONG_FROM_INT(UINT_TYPE, INT_TYPE, ival) \
|
||||
|
|
@ -3622,16 +3632,6 @@ long_richcompare(PyObject *self, PyObject *other, int op)
|
|||
Py_RETURN_RICHCOMPARE(result, 0, op);
|
||||
}
|
||||
|
||||
static inline int
|
||||
/// Return 1 if the object is one of the immortal small ints
|
||||
_long_is_small_int(PyObject *op)
|
||||
{
|
||||
PyLongObject *long_object = (PyLongObject *)op;
|
||||
int is_small_int = (long_object->long_value.lv_tag & IMMORTALITY_BIT_MASK) != 0;
|
||||
assert((!is_small_int) || PyLong_CheckExact(op));
|
||||
return is_small_int;
|
||||
}
|
||||
|
||||
void
|
||||
_PyLong_ExactDealloc(PyObject *self)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue