ArmPkg: Enhance CompareGuid performance by using CompareMem instead of nested unaligned read calls

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen eugene@hp.com
Reviewed-by: Olivier Martin olivier.martin@arm.com



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13409 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2012-05-31 15:28:37 +00:00
parent f01b91ae42
commit c4c9086678
2 changed files with 2 additions and 22 deletions

View File

@ -81,17 +81,7 @@ CompareGuid (
IN CONST GUID *Guid2
)
{
UINT64 LowPartOfGuid1;
UINT64 LowPartOfGuid2;
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
return (CompareMem(Guid1, Guid2, sizeof(GUID)) == 0) ? TRUE : FALSE;
}
/**

View File

@ -81,17 +81,7 @@ CompareGuid (
IN CONST GUID *Guid2
)
{
UINT64 LowPartOfGuid1;
UINT64 LowPartOfGuid2;
UINT64 HighPartOfGuid1;
UINT64 HighPartOfGuid2;
LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
return (CompareMem(Guid1, Guid2, sizeof(GUID) == 0)) ? TRUE : FALSE;
}
/**