Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Objects/stringlib/eq.h
Line
Count
Source (jump to first uncovered line)
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
unicode_eq(PyObject *a, PyObject *b)
8
{
9
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
  Branch (9:9): [True: 0, False: 20.6M]
  Branch (9:9): [True: 257k, False: 462k]
10
        return 0;
11
    if (PyUnicode_GET_LENGTH(a) == 0)
  Branch (11:9): [True: 0, False: 20.6M]
  Branch (11:9): [True: 0, False: 462k]
12
        return 1;
13
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
  Branch (13:9): [True: 0, False: 20.6M]
  Branch (13:9): [True: 0, False: 462k]
14
        return 0;
15
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
16
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
17
}
dictobject.c:unicode_eq
Line
Count
Source
8
{
9
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
  Branch (9:9): [True: 0, False: 20.6M]
10
        return 0;
11
    if (PyUnicode_GET_LENGTH(a) == 0)
  Branch (11:9): [True: 0, False: 20.6M]
12
        return 1;
13
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
  Branch (13:9): [True: 0, False: 20.6M]
14
        return 0;
15
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
16
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
17
}
unicodeobject.c:unicode_eq
Line
Count
Source
8
{
9
    if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
  Branch (9:9): [True: 257k, False: 462k]
10
        return 0;
11
    if (PyUnicode_GET_LENGTH(a) == 0)
  Branch (11:9): [True: 0, False: 462k]
12
        return 1;
13
    if (PyUnicode_KIND(a) != PyUnicode_KIND(b))
  Branch (13:9): [True: 0, False: 462k]
14
        return 0;
15
    return memcmp(PyUnicode_1BYTE_DATA(a), PyUnicode_1BYTE_DATA(b),
16
                  PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)) == 0;
17
}