From: Marc-André Lemburg <mal@egenix.com>
Date: Sun, 18 Jun 2000 22:22:27 +0000 (+0000)
Subject: Marc-Andre Lemburg <mal@lemburg.com>:
X-Git-Tag: v2.0b1~1475
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f4d0e9bb6a1988b59274bd6db980b214fb17d23;p=python

Marc-Andre Lemburg <mal@lemburg.com>:
Added optimization proposed by Andrew Kuchling to the Unicode
matching macro.
---

diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index bed3b7b8a1..967334ae2d 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -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