From 26d19f7d2222f594ae236d411faf5d929ea30fc7 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Tue, 20 Mar 2001 02:26:23 +0000 Subject: [PATCH] ICU-880 faster loop for strcoll leading chars == comparison. X-SVN-Rev: 4191 --- icu4c/source/i18n/ucol.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index 5bcc9fe5a89..43acc07fc65 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -2731,21 +2731,21 @@ ucol_strcoll( const UCollator *coll, const UChar *pSrcEnd = source + sourceLength; const UChar *pTargEnd = target + targetLength; - int32_t equalLength = 0; + int32_t equalLength; // Scan while the strings are bitwise ==, or until one is exhausted. for (;;) { if (pSrc == pSrcEnd || pTarg == pTargEnd) break; - if (*pSrc != *pTarg) - break; if (*pSrc == 0 && (sourceLength == -1 || targetLength == -1)) break; - equalLength++; + if (*pSrc != *pTarg) + break; pSrc++; pTarg++; } - + equalLength = pSrc - source; + // If we made it all the way through both strings, we are done. They are == if ((pSrc ==pSrcEnd || (pSrcEnd