]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
MdePkg: Apply uncrustify changes
[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 BaseMemoryLib\r
6 BaseMemoryLibMmx\r
7 BaseMemoryLibSse2\r
8 BaseMemoryLibRepStr\r
2bfb6009
LG
9 BaseMemoryLibOptDxe\r
10 BaseMemoryLibOptPei\r
7b3b4b29 11 PeiMemoryLib\r
1fef058f 12 UefiMemoryLib\r
7b3b4b29 13\r
9095d37b 14Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 15SPDX-License-Identifier: BSD-2-Clause-Patent\r
7b3b4b29 16\r
eb1c78db 17**/\r
7b3b4b29 18\r
19#include "MemLibInternals.h"\r
20\r
21/**\r
22 Compares the contents of two buffers.\r
23\r
24 This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.\r
25 If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the\r
26 value returned is the first mismatched byte in SourceBuffer subtracted from the first\r
27 mismatched byte in DestinationBuffer.\r
9095d37b 28\r
2bfb6009
LG
29 If Length > 0 and DestinationBuffer is NULL, then ASSERT().\r
30 If Length > 0 and SourceBuffer is NULL, then ASSERT().\r
eb1c78db 31 If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().\r
32 If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\r
7b3b4b29 33\r
2fc59a00 34 @param DestinationBuffer The pointer to the destination buffer to compare.\r
35 @param SourceBuffer The pointer to the source buffer to compare.\r
36 @param Length The number of bytes to compare.\r
7b3b4b29 37\r
eb1c78db 38 @return 0 All Length bytes of the two buffers are identical.\r
7b3b4b29 39 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first\r
40 mismatched byte in DestinationBuffer.\r
9095d37b 41\r
7b3b4b29 42**/\r
43INTN\r
44EFIAPI\r
45CompareMem (\r
46 IN CONST VOID *DestinationBuffer,\r
47 IN CONST VOID *SourceBuffer,\r
48 IN UINTN Length\r
49 )\r
50{\r
2f88bd3a 51 if ((Length == 0) || (DestinationBuffer == SourceBuffer)) {\r
7b3b4b29 52 return 0;\r
53 }\r
2f88bd3a 54\r
7b3b4b29 55 ASSERT (DestinationBuffer != NULL);\r
56 ASSERT (SourceBuffer != NULL);\r
57 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)DestinationBuffer));\r
58 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)SourceBuffer));\r
59\r
60 return InternalMemCompareMem (DestinationBuffer, SourceBuffer, Length);\r
61}\r