]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
MdePkg BaseMemoryLib: Add implementation of API IsZeroGuid()
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibRepStr / MemLibGuid.c
index 6f6edd0d8ff2738a5b728202ca0493106a9c1ff9..cbb385fddfba8b4b7de2df526202264e8ce101f1 100644 (file)
@@ -12,7 +12,7 @@
     PeiMemoryLib\r
     UefiMemoryLib\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -140,3 +140,32 @@ ScanGuid (
   }\r
   return NULL;\r
 }\r
+\r
+/**\r
+  Checks if the given GUID is a zero GUID.\r
+\r
+  This function checks whether the given GUID is a zero GUID. If the GUID is\r
+  identical to a zero GUID then TRUE is returned. Otherwise, FALSE is returned.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param  Guid        The pointer to a 128 bit GUID.\r
+\r
+  @retval TRUE        Guid is a zero GUID.\r
+  @retval FALSE       Guid is not a zero GUID.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsZeroGuid (\r
+  IN CONST GUID  *Guid\r
+  )\r
+{\r
+  UINT64  LowPartOfGuid;\r
+  UINT64  HighPartOfGuid;\r
+\r
+  LowPartOfGuid  = ReadUnaligned64 ((CONST UINT64*) Guid);\r
+  HighPartOfGuid = ReadUnaligned64 ((CONST UINT64*) Guid + 1);\r
+\r
+  return (BOOLEAN) (LowPartOfGuid == 0 && HighPartOfGuid == 0);\r
+}\r