diff options
author | Mark Shannon <mark@hotpy.org> | 2021-08-27 08:21:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 08:21:01 (GMT) |
commit | d3eaf0cc5b311ad023fd13e367f817d528403306 (patch) | |
tree | d21a76b0e3aa781e66d07442c75599e35c3d27bd /Objects | |
parent | 245f1f260577a005fd631144b4377febef0b47ed (diff) | |
download | cpython-d3eaf0cc5b311ad023fd13e367f817d528403306.zip cpython-d3eaf0cc5b311ad023fd13e367f817d528403306.tar.gz cpython-d3eaf0cc5b311ad023fd13e367f817d528403306.tar.bz2 |
bpo-44945: Specialize BINARY_ADD (GH-27967)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/longobject.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 18b0839..3b6df12 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3119,16 +3119,14 @@ x_sub(PyLongObject *a, PyLongObject *b) return maybe_small_long(long_normalize(z)); } -static PyObject * -long_add(PyLongObject *a, PyLongObject *b) +PyObject * +_PyLong_Add(PyLongObject *a, PyLongObject *b) { - PyLongObject *z; - - CHECK_BINOP(a, b); - if (IS_MEDIUM_VALUE(a) && IS_MEDIUM_VALUE(b)) { return _PyLong_FromSTwoDigits(medium_value(a) + medium_value(b)); } + + PyLongObject *z; if (Py_SIZE(a) < 0) { if (Py_SIZE(b) < 0) { z = x_add(a, b); @@ -3154,6 +3152,14 @@ long_add(PyLongObject *a, PyLongObject *b) } static PyObject * +long_add(PyLongObject *a, PyLongObject *b) +{ + CHECK_BINOP(a, b); + return _PyLong_Add(a, b); +} + + +static PyObject * long_sub(PyLongObject *a, PyLongObject *b) { PyLongObject *z; |