LCOV - code coverage report
Current view: | top level - Objects/stringlib - eq.h (source / functions) |  |  | Hit | Total | Coverage
Test: | CPython 3.12 LCOV report [commit 5e6661bce9] |  | Lines: | 7 | 9 | 77.8 %
Date: | 2023-03-20 08:15:36 |  | Functions: | 1 | 1 | 100.0 %
|  |  | Branches: | 4 | 6 | 66.7 %

               Branch data     Line data    Source code
           1                 :            : /* Fast unicode equal function optimized for dictobject.c and setobject.c */
           2                 :            :
           3                 :            : /* Return 1 if two unicode objects are equal, 0 if not.
           4                 :            :  * unicode_eq() is called when the hash of two unicode objects is equal.
           5                 :            :  */
           6                 :            : Py_LOCAL_INLINE(int)
           7                 :    2109157 : unicode_eq(PyObject *a, PyObject *b)
           8                 :            : {
           9         [ +  + ]:    2109157 :     if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
          10                 :       1984 :         return 0;
          11         [ -  + ]:    2107173 :     if (PyUnicode_GET_LENGTH(a) == 0)
          12                 :          0 :         return 1;
          13         [ -  + ]:    2107173 :     if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
          14                 :          0 :         return 0;
          15                 :    2107173 :     return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
          16                 :    4214346 :                   PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
          17                 :            : }

Generated by: LCOV version 1.14