]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
DebugLib:
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / MemLibGuid.c
... / ...
CommitLineData
1/** @file\r
2 Implementation of GUID functions.\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: MemLibGuid.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 DxeMemoryLib\r
23\r
24**/\r
25\r
26/**\r
27 Copies a source GUID to a destination GUID.\r
28\r
29 This function copies the contents of the 128-bit GUID specified by SourceGuid to\r
30 DestinationGuid, and returns DestinationGuid.\r
31 If DestinationGuid is NULL, then ASSERT().\r
32 If SourceGuid is NULL, then ASSERT().\r
33\r
34 @param DestinationGuid Pointer to the destination GUID.\r
35 @param SourceGuid Pointer to the source GUID.\r
36\r
37 @return DestinationGuid.\r
38\r
39**/\r
40GUID *\r
41EFIAPI\r
42CopyGuid (\r
43 OUT GUID *DestinationGuid,\r
44 IN CONST GUID *SourceGuid\r
45 )\r
46{\r
47 WriteUnaligned64 (\r
48 (UINT64*)DestinationGuid,\r
49 ReadUnaligned64 ((CONST UINT64*)SourceGuid)\r
50 );\r
51 WriteUnaligned64 (\r
52 (UINT64*)DestinationGuid + 1,\r
53 ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)\r
54 );\r
55 return DestinationGuid;\r
56}\r
57\r
58/**\r
59 Compares two GUIDs.\r
60\r
61 This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.\r
62 If there are any bit differences in the two GUIDs, then FALSE is returned.\r
63 If Guid1 is NULL, then ASSERT().\r
64 If Guid2 is NULL, then ASSERT().\r
65\r
66 @param Guid1 A pointer to a 128 bit GUID.\r
67 @param Guid2 A pointer to a 128 bit GUID.\r
68\r
69 @retval TRUE Guid1 and Guid2 are identical.\r
70 @retval FALSE Guid1 and Guid2 are not identical.\r
71\r
72**/\r
73BOOLEAN\r
74EFIAPI\r
75CompareGuid (\r
76 IN CONST GUID *Guid1,\r
77 IN CONST GUID *Guid2\r
78 )\r
79{\r
80 return (BOOLEAN)(\r
81 ReadUnaligned64 ((CONST UINT64*)Guid1)\r
82 == ReadUnaligned64 ((CONST UINT64*)Guid2) &&\r
83 ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)\r
84 == ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)\r
85 );\r
86}\r
87\r
88/**\r
89 Scans a target buffer for a GUID, and returns a pointer to the matching GUID\r
90 in the target buffer.\r
91\r
92 This function searches target the buffer specified by Buffer and Length from\r
93 the lowest address to the highest address at 128-bit increments for the 128-bit\r
94 GUID value that matches Guid. If a match is found, then a pointer to the matching\r
95 GUID in the target buffer is returned. If no match is found, then NULL is returned.\r
96 If Length is 0, then NULL is returned.\r
97 If Length > 0 and Buffer is NULL, then ASSERT().\r
98 If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
99 If Length is not aligned on a 128-bit boundary, then ASSERT().\r
100