]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
remove unnecessary comments introduced by tools from MdePkg. The regular express...
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibOptPei / CompareMemWrapper.c
1 /** @file
2 CompareMem() implementation.
3
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
9
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.
12
13 The following BaseMemoryLib instances share the same version of this file:
14
15 BaseMemoryLib
16 BaseMemoryLibMmx
17 BaseMemoryLibSse2
18 BaseMemoryLibRepStr
19 PeiMemoryLib
20 DxeMemoryLib
21
22 **/
23
24
25
26
27 #include "MemLibInternals.h"
28
29 /**
30 Compares the contents of two buffers.
31
32 This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
33 If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
34 value returned is the first mismatched byte in SourceBuffer subtracted from the first
35 mismatched byte in DestinationBuffer.
36 If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
37 If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
38 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
39 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
40
41
42 @param DestinationBuffer Pointer to the destination buffer to compare.
43 @param SourceBuffer Pointer to the source buffer to compare.
44 @param Length Number of bytes to compare.
45
46 @return 0 All Length bytes of the two buffers are identical.
47 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
48 mismatched byte in DestinationBuffer.
49
50 **/
51 INTN
52 EFIAPI
53 CompareMem (
54 IN CONST VOID *DestinationBuffer,
55 IN CONST VOID *SourceBuffer,
56 IN UINTN Length
57 )
58 {
59 if (Length == 0 || DestinationBuffer == SourceBuffer) {
60 return 0;
61 }
62 ASSERT (DestinationBuffer != NULL);
63 ASSERT (SourceBuffer != NULL);
64 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));
65 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));
66
67 return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);
68 }