MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / __Pyx_PyBytes_Equals

Function __Pyx_PyBytes_Equals

eval/CIPO_evaluation/pycocotools/_mask.c:10765–10809  ·  view source on GitHub ↗

BytesEquals */

Source from the content-addressed store, hash-verified

10763
10764/* BytesEquals */
10765static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
10766#if CYTHON_COMPILING_IN_PYPY
10767 return PyObject_RichCompareBool(s1, s2, equals);
10768#else
10769 if (s1 == s2) {
10770 return (equals == Py_EQ);
10771 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
10772 const char *ps1, *ps2;
10773 Py_ssize_t length = PyBytes_GET_SIZE(s1);
10774 if (length != PyBytes_GET_SIZE(s2))
10775 return (equals == Py_NE);
10776 ps1 = PyBytes_AS_STRING(s1);
10777 ps2 = PyBytes_AS_STRING(s2);
10778 if (ps1[0] != ps2[0]) {
10779 return (equals == Py_NE);
10780 } else if (length == 1) {
10781 return (equals == Py_EQ);
10782 } else {
10783 int result;
10784#if CYTHON_USE_UNICODE_INTERNALS
10785 Py_hash_t hash1, hash2;
10786 hash1 = ((PyBytesObject*)s1)->ob_shash;
10787 hash2 = ((PyBytesObject*)s2)->ob_shash;
10788 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
10789 return (equals == Py_NE);
10790 }
10791#endif
10792 result = memcmp(ps1, ps2, (size_t)length);
10793 return (equals == Py_EQ) ? (result == 0) : (result != 0);
10794 }
10795 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
10796 return (equals == Py_NE);
10797 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
10798 return (equals == Py_NE);
10799 } else {
10800 int result;
10801 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
10802 if (!py_result)
10803 return -1;
10804 result = __Pyx_PyObject_IsTrue(py_result);
10805 Py_DECREF(py_result);
10806 return result;
10807 }
10808#endif
10809}
10810
10811/* UnicodeEquals */
10812static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {

Callers 1

__Pyx_PyUnicode_EqualsFunction · 0.85

Calls 1

__Pyx_PyObject_IsTrueFunction · 0.85

Tested by

no test coverage detected