3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Generic compare-memory routine.
23 #include "EfiDriverLib.h"
36 Compares two memory buffers of a given length.
40 MemOne - First memory buffer
42 MemTwo - Second memory buffer
44 Len - Length of Mem1 and Mem2 memory regions to compare
48 = 0 if MemOne == MemTwo
54 if (!(EFI_UINTN_ALIGNED (MemOne
) || EFI_UINTN_ALIGNED (MemTwo
) || EFI_UINTN_ALIGNED (Length
))) {
56 // If Destination/Source/Length are aligned do UINTN conpare
58 for (; Length
> 0; Length
-= sizeof (INTN
), MemOne
= (VOID
*)((UINTN
)MemOne
+ sizeof (INTN
)), MemTwo
= (VOID
*)((UINTN
)MemTwo
+ sizeof (INTN
))) {
59 if (*(INTN
*)MemOne
!= *(INTN
*)MemTwo
) {
66 // If Destination/Source/Length not aligned do byte compare
68 for (; Length
> 0; Length
--, MemOne
= (VOID
*)((UINTN
)MemOne
+ 1), MemTwo
= (VOID
*)((UINTN
)MemTwo
+ 1)) {
69 ReturnValue
= (INTN
)(*(INT8
*)MemOne
- *(INT8
*)MemTwo
);
70 if (ReturnValue
!= 0) {