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