Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f4d0e9

Browse files
committed
Marc-Andre Lemburg <[email protected]>:
Added optimization proposed by Andrew Kuchling to the Unicode matching macro.
1 parent e8d52af commit 2f4d0e9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Include/unicodeobject.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ typedef unsigned short Py_UNICODE;
168168
while (0)
169169

170170
#define Py_UNICODE_MATCH(string, offset, substring)\
171-
(!memcmp((string)->str + (offset), (substring)->str,\
171+
((*((string)->str + (offset)) == *((substring)->str)) &&\
172+
!memcmp((string)->str + (offset), (substring)->str,\
172173
(substring)->length*sizeof(Py_UNICODE)))
173174

174175
#ifdef __cplusplus

0 commit comments

Comments
 (0)