Marc-Andre Lemburg <mal@lemburg.com>:

Added optimization proposed by Andrew Kuchling to the Unicode
matching macro.
This commit is contained in:
Marc-André Lemburg 2000-06-18 22:22:27 +00:00
parent e8d52af54b
commit 2f4d0e9bb6
1 changed files with 2 additions and 1 deletions

View File

@ -168,7 +168,8 @@ typedef unsigned short Py_UNICODE;
while (0) while (0)
#define Py_UNICODE_MATCH(string, offset, substring)\ #define Py_UNICODE_MATCH(string, offset, substring)\
(!memcmp((string)->str + (offset), (substring)->str,\ ((*((string)->str + (offset)) == *((substring)->str)) &&\
!memcmp((string)->str + (offset), (substring)->str,\
(substring)->length*sizeof(Py_UNICODE))) (substring)->length*sizeof(Py_UNICODE)))
#ifdef __cplusplus #ifdef __cplusplus