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