mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-45367: Specialize BINARY_MULTIPLY (GH-28727)
This commit is contained in:
parent
c96d1546b1
commit
3b3d30e8f7
9 changed files with 162 additions and 55 deletions
|
|
@ -3594,13 +3594,11 @@ k_lopsided_mul(PyLongObject *a, PyLongObject *b)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
long_mul(PyLongObject *a, PyLongObject *b)
|
||||
PyObject *
|
||||
_PyLong_Multiply(PyLongObject *a, PyLongObject *b)
|
||||
{
|
||||
PyLongObject *z;
|
||||
|
||||
CHECK_BINOP(a, b);
|
||||
|
||||
/* fast path for single-digit multiplication */
|
||||
if (IS_MEDIUM_VALUE(a) && IS_MEDIUM_VALUE(b)) {
|
||||
stwodigits v = medium_value(a) * medium_value(b);
|
||||
|
|
@ -3617,6 +3615,13 @@ long_mul(PyLongObject *a, PyLongObject *b)
|
|||
return (PyObject *)z;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
long_mul(PyLongObject *a, PyLongObject *b)
|
||||
{
|
||||
CHECK_BINOP(a, b);
|
||||
return _PyLong_Multiply(a, b);
|
||||
}
|
||||
|
||||
/* Fast modulo division for single-digit longs. */
|
||||
static PyObject *
|
||||
fast_mod(PyLongObject *a, PyLongObject *b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue