mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
long_mul(): Simplified exit code. In particular, k_mul() returns a
normalized result, so no point to normalizing it again. The number of test+branches was also excessive.
This commit is contained in:
parent
dd32a91cc0
commit
9973d74b2d
1 changed files with 3 additions and 9 deletions
|
@ -1878,18 +1878,12 @@ long_mul(PyLongObject *v, PyLongObject *w)
|
||||||
}
|
}
|
||||||
|
|
||||||
z = k_mul(a, b);
|
z = k_mul(a, b);
|
||||||
if(z == NULL) {
|
/* Negate if exactly one of the inputs is negative. */
|
||||||
Py_DECREF(a);
|
if (((a->ob_size ^ b->ob_size) < 0) && z)
|
||||||
Py_DECREF(b);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (a->ob_size < 0)
|
|
||||||
z->ob_size = -(z->ob_size);
|
|
||||||
if (b->ob_size < 0)
|
|
||||||
z->ob_size = -(z->ob_size);
|
z->ob_size = -(z->ob_size);
|
||||||
Py_DECREF(a);
|
Py_DECREF(a);
|
||||||
Py_DECREF(b);
|
Py_DECREF(b);
|
||||||
return (PyObject *) long_normalize(z);
|
return (PyObject *)z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The / and % operators are now defined in terms of divmod().
|
/* The / and % operators are now defined in terms of divmod().
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue