Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
070bfaea
Commit
070bfaea
authored
Apr 29, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
also optimise comparing bytes objects of equal length, instead of using a generic fallback for them
parent
ddde94b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+7
-4
No files found.
Cython/Compiler/ExprNodes.py
View file @
070bfaea
...
@@ -6908,13 +6908,15 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
...
@@ -6908,13 +6908,15 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
else
else
return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
} /* else: fall back to PyObject_RichCompare() below */
} else {
int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), PyBytes_GET_SIZE(s1));
return (equals == Py_EQ) ? (result == 0) : (result != 0);
}
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
return (equals == Py_NE);
return (equals == Py_NE);
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
return (equals == Py_NE);
return (equals == Py_NE);
}
} else {
{
int result;
int result;
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
if (!py_result)
if (!py_result)
...
@@ -6924,7 +6926,8 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
...
@@ -6924,7 +6926,8 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
return result;
return result;
}
}
}
}
"""
)
"""
,
requires
=
[
Builtin
.
include_string_h_utility_code
])
pystr_equals_utility_code
=
UtilityCode
(
pystr_equals_utility_code
=
UtilityCode
(
proto
=
"""
proto
=
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment