cpython: c21bf38a9d07 (original) (raw)
Mercurial > cpython
changeset 101664:c21bf38a9d07
Issue #27073: Removed redundant checks in long_add and long_sub. Patch by Oren Milman. [#27073]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Sat, 04 Jun 2016 00:06:45 +0300 |
parents | 8b6b6add8e47 |
children | 37975d542715 |
files | Objects/longobject.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-)[+] [-] Objects/longobject.c 12 |
line wrap: on
line diff
--- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3022,8 +3022,14 @@ long_add(PyLongObject *a, PyLongObject * if (Py_SIZE(a) < 0) { if (Py_SIZE(b) < 0) { z = x_add(a, b);
if (z != NULL && Py_SIZE(z) != 0)[](#l1.7)
if (z != NULL) {[](#l1.8)
/* x_add received at least one multiple-digit int,[](#l1.9)
and thus z must be a multiple-digit int.[](#l1.10)
That also means z is not an element of[](#l1.11)
small_ints, so negating it in-place is safe. */[](#l1.12)
assert(Py_REFCNT(z) == 1);[](#l1.13) Py_SIZE(z) = -(Py_SIZE(z));[](#l1.14)
}[](#l1.15) }[](#l1.16) else[](#l1.17) z = x_sub(b, a);[](#l1.18)
@@ -3054,8 +3060,10 @@ long_sub(PyLongObject *a, PyLongObject * z = x_sub(a, b); else z = x_add(a, b);
if (z != NULL && Py_SIZE(z) != 0)[](#l1.23)