]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/UefiMemoryLib/CompareMemWrapper.c
2 CompareMem() implementation.
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 Module Name: CompareMemWrapper.c
15 The following BaseMemoryLib instances share the same version of this file:
26 #include "MemLibInternals.h"
29 Compares two memory buffers of a given length.
31 This function compares Length bytes of SourceBuffer to Length bytes of
32 DestinationBuffer. If all Length bytes of the two buffers are identical, then
33 0 is returned. Otherwise, the value returned is the first mismatched byte in
34 SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.
36 If DestinationBuffer is NULL and Length > 0, then ASSERT().
37 If SourceBuffer is NULL and Length > 0, then ASSERT().
38 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then
40 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
42 @param DestinationBuffer First memory buffer
43 @param SourceBuffer Second memory buffer
44 @param Length Length of DestinationBuffer and SourceBuffer memory
47 @retval 0 if DestinationBuffer == SourceBuffer
48 @retval Non-zero if DestinationBuffer != SourceBuffer
54 IN CONST VOID
*DestinationBuffer
,
55 IN CONST VOID
*SourceBuffer
,
59 ASSERT (DestinationBuffer
!= NULL
);
60 ASSERT (SourceBuffer
!= NULL
);
61 ASSERT (Length
<= MAX_ADDRESS
- (UINTN
)DestinationBuffer
+ 1);
62 ASSERT (Length
<= MAX_ADDRESS
- (UINTN
)SourceBuffer
+ 1);
66 return InternalMemCompareMem (DestinationBuffer
, SourceBuffer
, Length
);