]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
Update copyright for files modified in this year
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibOptPei / CompareMemWrapper.c
CommitLineData
7b3b4b29 1/** @file\r
2 CompareMem() implementation.\r
3\r
2bfb6009 4 The following BaseMemoryLib instances contain the same copy of this file:\r
7b3b4b29 5\r
6 BaseMemoryLib\r
7 BaseMemoryLibMmx\r
8 BaseMemoryLibSse2\r
9 BaseMemoryLibRepStr\r
2bfb6009
LG
10 BaseMemoryLibOptDxe\r
11 BaseMemoryLibOptPei\r
7b3b4b29 12 PeiMemoryLib\r
13 DxeMemoryLib\r
14\r
373ade0e 15Copyright (c) 2006 - 2008, Intel Corporation\r
eb1c78db 16All rights reserved. This program and the accompanying materials\r
17are licensed and made available under the terms and conditions of the BSD License\r
18which accompanies this distribution. The full text of the license may be found at\r
19http://opensource.org/licenses/bsd-license.php\r
1efcc4ae 20\r
eb1c78db 21THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
22WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
7b3b4b29 23\r
eb1c78db 24**/\r
7b3b4b29 25\r
26#include "MemLibInternals.h"\r
27\r
28/**\r
29 Compares the contents of two buffers.\r
30\r
31 This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.\r
32 If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the\r
33 value returned is the first mismatched byte in SourceBuffer subtracted from the first\r
34 mismatched byte in DestinationBuffer.\r
efb23117 35 \r
2bfb6009
LG
36 If Length > 0 and DestinationBuffer is NULL, then ASSERT().\r
37 If Length > 0 and SourceBuffer is NULL, then ASSERT().\r
eb1c78db 38 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().\r
39 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\r
7b3b4b29 40\r
41 @param DestinationBuffer Pointer to the destination buffer to compare.\r
42 @param SourceBuffer Pointer to the source buffer to compare.\r
43 @param Length Number of bytes to compare.\r
44\r
eb1c78db 45 @return 0 All Length bytes of the two buffers are identical.\r
7b3b4b29 46 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first\r
47 mismatched byte in DestinationBuffer.\r
efb23117 48 \r
7b3b4b29 49**/\r
50INTN\r
51EFIAPI\r
52CompareMem (\r
53 IN CONST VOID *DestinationBuffer,\r
54 IN CONST VOID *SourceBuffer,\r
55 IN UINTN Length\r
56 )\r
57{\r
cc4e0485 58 if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
7b3b4b29 59 return 0;\r
60 }\r
61 ASSERT (DestinationBuffer != NULL);\r
62 ASSERT (SourceBuffer != NULL);\r
63 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
64 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
65\r
66 return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
67}\r