From 14190c19d7095c80564fb699b8a605399cc142e4 Mon Sep 17 00:00:00 2001 From: Khaled Noaman <knoaman@apache.org> Date: Wed, 11 Dec 2002 22:09:08 +0000 Subject: [PATCH] Performance: reduce instructions count. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@174503 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/internal/XMLReader.hpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/xercesc/internal/XMLReader.hpp b/src/xercesc/internal/XMLReader.hpp index 77090b611..4305ac21c 100644 --- a/src/xercesc/internal/XMLReader.hpp +++ b/src/xercesc/internal/XMLReader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.10 2002/12/11 22:09:08 knoaman + * Performance: reduce instructions count. + * * Revision 1.9 2002/12/03 15:31:19 knoaman * Enable/disable calculation of src offset. * @@ -742,30 +745,23 @@ inline void XMLReader::setThrowAtEnd(const bool newValue) // --------------------------------------------------------------------------- inline void XMLReader::movePlainContentChars(XMLBuffer &dest) { - int count = 0; - XMLCh *pStart = &fCharBuf[fCharIndex]; - XMLCh *pCurrent = pStart; - XMLCh *pEnd = &fCharBuf[fCharsAvail]; - + unsigned int count = fCharIndex; - while (pCurrent < pEnd) + while (fCharIndex < fCharsAvail) { - if (! XMLReader::isPlainContentChar(*pCurrent++)) + if (!XMLReader::isPlainContentChar(fCharBuf[fCharIndex])) break; - count++; + fCharIndex++; } - if (count > 0) + if (count != fCharIndex) { - fCharIndex += count; - fCurCol += count; - dest.append(pStart, count); + fCurCol += (fCharIndex - count); + dest.append(&fCharBuf[count], fCharIndex - count); } } - - // --------------------------------------------------------------------------- // XMLReader: getNextCharIfNot() method inlined for speed // --------------------------------------------------------------------------- -- GitLab