]> granicus.if.org Git - python/commitdiff
Marc-Andre Lemburg <mal@lemburg.com>:
authorMarc-André Lemburg <mal@egenix.com>
Sun, 18 Jun 2000 22:22:27 +0000 (22:22 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Sun, 18 Jun 2000 22:22:27 +0000 (22:22 +0000)
Added optimization proposed by Andrew Kuchling to the Unicode
matching macro.

Include/unicodeobject.h

index bed3b7b8a1a176f73c3f293019baeda6bf1ffa81..967334ae2dce0968303a8e8129b00156cea07815 100644 (file)
@@ -168,7 +168,8 @@ typedef unsigned short Py_UNICODE;
     while (0)
 
 #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)))
 
 #ifdef __cplusplus