]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c
2 CompareMem() implementation.
4 The following BaseMemoryLib instances contain the same copy of this file:
14 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
15 This program and the accompanying materials
16 are licensed and made available under the terms and conditions of the BSD License
17 which accompanies this distribution. The full text of the license may be found at
18 http://opensource.org/licenses/bsd-license.php
20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 #include "MemLibInternals.h"
28 Compares the contents of two buffers.
30 This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
31 If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
32 value returned is the first mismatched byte in SourceBuffer subtracted from the first
33 mismatched byte in DestinationBuffer.
35 If Length > 0 and DestinationBuffer is NULL, then ASSERT().
36 If Length > 0 and SourceBuffer is NULL, then ASSERT().
37 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
38 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
40 @param DestinationBuffer The pointer to the destination buffer to compare.
41 @param SourceBuffer The pointer to the source buffer to compare.
42 @param Length The number of bytes to compare.
44 @return 0 All Length bytes of the two buffers are identical.
45 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
46 mismatched byte in DestinationBuffer.
52 IN CONST VOID
*DestinationBuffer
,
53 IN CONST VOID
*SourceBuffer
,
57 if (Length
== 0 || DestinationBuffer
== SourceBuffer
) {
60 ASSERT (DestinationBuffer
!= NULL
);
61 ASSERT (SourceBuffer
!= NULL
);
62 ASSERT ((Length
- 1) <= (MAX_ADDRESS
- (UINTN
)DestinationBuffer
));
63 ASSERT ((Length
- 1) <= (MAX_ADDRESS
- (UINTN
)SourceBuffer
));
65 return InternalMemCompareMem (DestinationBuffer
, SourceBuffer
, Length
);