Optimize GetUnicodeStringTextOrSize's inner loop to call ReadUnalign16 instead of CompareMem and remove a unnecessary local variable.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5580 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-07-28 05:36:44 +00:00
parent 54bac0db0b
commit aa2e1536cb
1 changed files with 1 additions and 3 deletions

View File

@ -163,15 +163,13 @@ GetUnicodeStringTextOrSize (
)
{
UINTN StringSize;
CHAR16 Zero;
UINT8 *StringPtr;
ASSERT (StringSrc != NULL && BufferSize != NULL);
ZeroMem (&Zero, sizeof (CHAR16));
StringSize = sizeof (CHAR16);
StringPtr = StringSrc;
while (CompareMem (StringPtr, &Zero, sizeof (CHAR16)) != 0) {
while (ReadUnaligned16 ((UINT16 *) StringPtr) != 0) {
StringSize += sizeof (CHAR16);
StringPtr += sizeof (CHAR16);
}