mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +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
|
@ -240,7 +240,7 @@ w_PyLong(const PyLongObject *ob, char flag, WFILE *p)
|
|||
/* set l to number of base PyLong_MARSHAL_BASE digits */
|
||||
n = Py_ABS(Py_SIZE(ob));
|
||||
l = (n-1) * PyLong_MARSHAL_RATIO;
|
||||
d = ob->ob_digit[n-1];
|
||||
d = ob->long_value.ob_digit[n-1];
|
||||
assert(d != 0); /* a PyLong is always normalized */
|
||||
do {
|
||||
d >>= PyLong_MARSHAL_SHIFT;
|
||||
|
@ -254,14 +254,14 @@ w_PyLong(const PyLongObject *ob, char flag, WFILE *p)
|
|||
w_long((long)(Py_SIZE(ob) > 0 ? l : -l), p);
|
||||
|
||||
for (i=0; i < n-1; i++) {
|
||||
d = ob->ob_digit[i];
|
||||
d = ob->long_value.ob_digit[i];
|
||||
for (j=0; j < PyLong_MARSHAL_RATIO; j++) {
|
||||
w_short(d & PyLong_MARSHAL_MASK, p);
|
||||
d >>= PyLong_MARSHAL_SHIFT;
|
||||
}
|
||||
assert (d == 0);
|
||||
}
|
||||
d = ob->ob_digit[n-1];
|
||||
d = ob->long_value.ob_digit[n-1];
|
||||
do {
|
||||
w_short(d & PyLong_MARSHAL_MASK, p);
|
||||
d >>= PyLong_MARSHAL_SHIFT;
|
||||
|
@ -853,7 +853,7 @@ r_PyLong(RFILE *p)
|
|||
goto bad_digit;
|
||||
d += (digit)md << j*PyLong_MARSHAL_SHIFT;
|
||||
}
|
||||
ob->ob_digit[i] = d;
|
||||
ob->long_value.ob_digit[i] = d;
|
||||
}
|
||||
|
||||
d = 0;
|
||||
|
@ -880,7 +880,7 @@ r_PyLong(RFILE *p)
|
|||
}
|
||||
/* top digit should be nonzero, else the resulting PyLong won't be
|
||||
normalized */
|
||||
ob->ob_digit[size-1] = d;
|
||||
ob->long_value.ob_digit[size-1] = d;
|
||||
return (PyObject *)ob;
|
||||
bad_digit:
|
||||
Py_DECREF(ob);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue