mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
GH-101291: Refactor the PyLongObject
struct into object header and PyLongValue struct. (GH-101292)
This commit is contained in:
parent
f5a3d91b6c
commit
c1b1f51cd1
13 changed files with 226 additions and 217 deletions
|
@ -2507,10 +2507,10 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
|
|||
overflow = 0;
|
||||
/* Single digits are common, fast, and cannot overflow on unpacking. */
|
||||
switch (Py_SIZE(item)) {
|
||||
case -1: b = -(sdigit) ((PyLongObject*)item)->ob_digit[0]; break;
|
||||
case -1: b = -(sdigit) ((PyLongObject*)item)->long_value.ob_digit[0]; break;
|
||||
// Note: the continue goes to the top of the "while" loop that iterates over the elements
|
||||
case 0: Py_DECREF(item); continue;
|
||||
case 1: b = ((PyLongObject*)item)->ob_digit[0]; break;
|
||||
case 1: b = ((PyLongObject*)item)->long_value.ob_digit[0]; break;
|
||||
default: b = PyLong_AsLongAndOverflow(item, &overflow); break;
|
||||
}
|
||||
if (overflow == 0 &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue