Mercurial > cpython-lru_cache-weakref
view Objects/stringlib/eq.h @ 48715:48dddfd2fbf3
RPC_WSTR is not available Visual Studio 2003 or earlier.
(Maybe I should have defined RPC_WSTR on old compiler,
but uuidcreate() is only place using it, so I simply replaced
with unsigned short *)
| author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> |
|---|---|
| date | Sun, 17 Aug 2008 07:26:26 +0000 |
| parents | 444da08f78a4 |
| children | cab14be0ada1 |
line wrap: on
line source
/* Fast unicode equal function optimized for dictobject.c and setobject.c */ /* Return 1 if two unicode objects are equal, 0 if not. * unicode_eq() is called when the hash of two unicode objects is equal. */ Py_LOCAL_INLINE(int) unicode_eq(PyObject *aa, PyObject *bb) { register PyUnicodeObject *a = (PyUnicodeObject *)aa; register PyUnicodeObject *b = (PyUnicodeObject *)bb; if (a->length != b->length) return 0; if (a->length == 0) return 1; if (a->str[0] != b->str[0]) return 0; if (a->length == 1) return 1; return memcmp(a->str, b->str, a->length * sizeof(Py_UNICODE)) == 0; }
