mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
Issue #16286: write a new subfunction bytes_compare_eq()
* cleanup bytes_richcompare() * PyUnicode_RichCompare(): replace a test with a XOR
This commit is contained in:
parent
63d867e95c
commit
c8bc5377ac
2 changed files with 50 additions and 42 deletions
|
@ -10526,7 +10526,7 @@ unicode_compare(PyObject *str1, PyObject *str2)
|
|||
#undef COMPARE
|
||||
}
|
||||
|
||||
static int
|
||||
Py_LOCAL(int)
|
||||
unicode_compare_eq(PyObject *str1, PyObject *str2)
|
||||
{
|
||||
int kind;
|
||||
|
@ -10630,10 +10630,8 @@ PyUnicode_RichCompare(PyObject *left, PyObject *right, int op)
|
|||
|
||||
if (op == Py_EQ || op == Py_NE) {
|
||||
result = unicode_compare_eq(left, right);
|
||||
if (op == Py_EQ)
|
||||
v = TEST_COND(result);
|
||||
else
|
||||
v = TEST_COND(!result);
|
||||
result ^= (op == Py_NE);
|
||||
v = TEST_COND(result);
|
||||
}
|
||||
else {
|
||||
result = unicode_compare(left, right);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue