summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-15 19:41:06 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-15 19:41:06 (GMT)
commit9973d74b2d63ebd6a49d239b49f01fe823705b97 (patch)
treef10885b46fbb394790ec44e3710ce6dd5d05374b /Objects/longobject.c
parentdd32a91cc0c8ba178d7ee5e78c30b6920aff66f4 (diff)
downloadcpython-9973d74b2d63ebd6a49d239b49f01fe823705b97.zip
cpython-9973d74b2d63ebd6a49d239b49f01fe823705b97.tar.gz
cpython-9973d74b2d63ebd6a49d239b49f01fe823705b97.tar.bz2
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.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 348dcc4..2343db8 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1878,18 +1878,12 @@ long_mul(PyLongObject *v, PyLongObject *w)
}
z = k_mul(a, b);
- if(z == NULL) {
- Py_DECREF(a);
- Py_DECREF(b);
- return NULL;
- }
- if (a->ob_size < 0)
- z->ob_size = -(z->ob_size);
- if (b->ob_size < 0)
+ /* Negate if exactly one of the inputs is negative. */
+ if (((a->ob_size ^ b->ob_size) < 0) && z)
z->ob_size = -(z->ob_size);
Py_DECREF(a);
Py_DECREF(b);
- return (PyObject *) long_normalize(z);
+ return (PyObject *)z;
}
/* The / and % operators are now defined in terms of divmod().