mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
bpo-45510: Specialize BINARY_SUBTRACT (GH-29523)
This commit is contained in:
parent
0920b61a0c
commit
345ba3f080
7 changed files with 107 additions and 50 deletions
|
@ -1424,6 +1424,19 @@ _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
|
|||
goto success;
|
||||
}
|
||||
break;
|
||||
case NB_SUBTRACT:
|
||||
case NB_INPLACE_SUBTRACT:
|
||||
if (PyLong_CheckExact(lhs)) {
|
||||
*instr = _Py_MAKECODEUNIT(BINARY_OP_SUBTRACT_INT,
|
||||
_Py_OPARG(*instr));
|
||||
goto success;
|
||||
}
|
||||
if (PyFloat_CheckExact(lhs)) {
|
||||
*instr = _Py_MAKECODEUNIT(BINARY_OP_SUBTRACT_FLOAT,
|
||||
_Py_OPARG(*instr));
|
||||
goto success;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// These operators don't have any available specializations. Rather
|
||||
// than repeatedly attempting to specialize them, just convert them
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue