LCOV - code coverage report
Current view: top level - Objects/stringlib - eq.h (source / functions) Hit Total Coverage
Test: CPython 3.12 LCOV report [commit acb105a7c1f] Lines: 7 9 77.8 %
Date: 2022-07-20 13:12:14 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                 :   81785379 : unicode_eq(PyObject *a, PyObject *b)
       8                 :            : {
       9         [ +  + ]:   81785379 :     if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
      10                 :     421416 :         return 0;
      11         [ -  + ]:   81363963 :     if (PyUnicode_GET_LENGTH(a) == 0)
      12                 :          0 :         return 1;
      13         [ -  + ]:   81363963 :     if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
      14                 :          0 :         return 0;
      15                 :   81363963 :     return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
      16                 :  162727926 :                   PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
      17                 :            : }

Generated by: LCOV version 1.14