diff options
author | Dong-hee Na <donghee.na@python.org> | 2021-11-18 09:19:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 09:19:58 (GMT) |
commit | 345ba3f080c140dee3102f472bc166c2db191bcc (patch) | |
tree | 302e16c6c660da6dcb5b5400447c24e90e4f4f2b /Objects | |
parent | 0920b61a0cb30128287ebafab1df8cad3a3dffdb (diff) | |
download | cpython-345ba3f080c140dee3102f472bc166c2db191bcc.zip cpython-345ba3f080c140dee3102f472bc166c2db191bcc.tar.gz cpython-345ba3f080c140dee3102f472bc166c2db191bcc.tar.bz2 |
bpo-45510: Specialize BINARY_SUBTRACT (GH-29523)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/longobject.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index a4d90b1..ce4f0d7 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3155,14 +3155,11 @@ long_add(PyLongObject *a, PyLongObject *b) return _PyLong_Add(a, b); } - -static PyObject * -long_sub(PyLongObject *a, PyLongObject *b) +PyObject * +_PyLong_Subtract(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)); } @@ -3187,6 +3184,13 @@ long_sub(PyLongObject *a, PyLongObject *b) return (PyObject *)z; } +static PyObject * +long_sub(PyLongObject *a, PyLongObject *b) +{ + CHECK_BINOP(a, b); + return _PyLong_Subtract(a, b); +} + /* Grade school multiplication, ignoring the signs. * Returns the absolute value of the product, or NULL if error. */ |