]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/BaseMemoryLib.h
MdePkg: Create GetRandomNumber128 in RngLib
[mirror_edk2.git] / MdePkg / Include / Library / BaseMemoryLib.h
index 5994530b55c0faca11f9a9ec4156d245be67c565..e3a46d0b495fbfdfde3377a01a910d1ffdda4fb8 100644 (file)
@@ -1,16 +1,18 @@
 /** @file\r
 /** @file\r
-       Memory-only library functions with no library constructor/destructor\r
+  Provides copy memory, fill memory, zero memory, and GUID functions.\r
+   \r
+  The Base Memory Library provides optimized implementations for common memory-based operations. \r
+  These functions should be used in place of coding your own loops to do equivalent common functions. \r
+  This allows optimized library implementations to help increase performance. \r
 \r
 \r
-       Copyright (c) 2006, Intel Corporation\r
-       All rights reserved. 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
-       http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under \r
+the terms and conditions of the BSD License that accompanies this distribution.  \r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.\r
 \r
 \r
-       THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-       WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-       Module Name:    BaseMemoryLib.h\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
 \r
 **/\r
 \r
 #define __BASE_MEMORY_LIB__\r
 \r
 /**\r
 #define __BASE_MEMORY_LIB__\r
 \r
 /**\r
-  Copy Length bytes from Source to Destination.\r
-\r
-  This function copies Length bytes from SourceBuffer to DestinationBuffer, and\r
-  returns DestinationBuffer. The implementation must be reentrant, and it must\r
-  handle the case where SourceBuffer overlaps DestinationBuffer.\r
+  Copies a source buffer to a destination buffer, and returns the destination buffer.\r
 \r
 \r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
+  This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns\r
+  DestinationBuffer.  The implementation must be reentrant, and it must handle the case\r
+  where SourceBuffer overlaps DestinationBuffer.\r
+  \r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\r
 \r
-  @param  Destination Target of copy\r
-  @param  Source Place to copy from\r
-  @param  Length Number of bytes to copy\r
+  @param  DestinationBuffer   The pointer to the destination buffer of the memory copy.\r
+  @param  SourceBuffer        The pointer to the source buffer of the memory copy.\r
+  @param  Length              The number of bytes to copy from SourceBuffer to DestinationBuffer.\r
 \r
 \r
-  @return Destination\r
+  @return DestinationBuffer.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 CopyMem (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 CopyMem (\r
-  OUT     VOID                      *DestinationBuffer,\r
-  IN      CONST VOID                *SourceBuffer,\r
-  IN      UINTN                     Length\r
+  OUT VOID       *DestinationBuffer,\r
+  IN CONST VOID  *SourceBuffer,\r
+  IN UINTN       Length\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Set Buffer to Value for Size bytes.\r
+  Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-\r
+  \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
-  @param  Buffer Memory to set.\r
-  @param  Size Number of bytes to set\r
-  @param  Value Value of the set operation.\r
+  @param  Buffer    The memory to set.\r
+  @param  Length    The number of bytes to set.\r
+  @param  Value     The value with which to fill Length bytes of Buffer.\r
 \r
 \r
-  @return Buffer\r
+  @return Buffer.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem (\r
-  OUT     VOID                      *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
+  OUT VOID  *Buffer,\r
+  IN UINTN  Length,\r
+  IN UINT8  Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -72,24 +73,24 @@ SetMem (
   Value, and returns Buffer. Value is repeated every 16-bits in for Length\r
   bytes of Buffer.\r
 \r
   Value, and returns Buffer. Value is repeated every 16-bits in for Length\r
   bytes of Buffer.\r
 \r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to fill.\r
-  @param  Length  Number of bytes in Buffer to fill.\r
-  @param  Value   Value with which to fill Length bytes of Buffer.\r
+  @param  Buffer  The pointer to the target buffer to fill.\r
+  @param  Length  The number of bytes in Buffer to fill.\r
+  @param  Value   The value with which to fill Length bytes of Buffer.\r
 \r
 \r
-  @return Buffer\r
+  @return Buffer.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem16 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem16 (\r
-  OUT     VOID                      *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
+  OUT VOID   *Buffer,\r
+  IN UINTN   Length,\r
+  IN UINT16  Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -99,24 +100,24 @@ SetMem16 (
   Value, and returns Buffer. Value is repeated every 32-bits in for Length\r
   bytes of Buffer.\r
 \r
   Value, and returns Buffer. Value is repeated every 32-bits in for Length\r
   bytes of Buffer.\r
 \r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to fill.\r
-  @param  Length  Number of bytes in Buffer to fill.\r
-  @param  Value   Value with which to fill Length bytes of Buffer.\r
+  @param  Buffer  The pointer to the target buffer to fill.\r
+  @param  Length  The number of bytes in Buffer to fill.\r
+  @param  Value   The value with which to fill Length bytes of Buffer.\r
 \r
 \r
-  @return Buffer\r
+  @return Buffer.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem32 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem32 (\r
-  OUT     VOID                      *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
+  OUT VOID   *Buffer,\r
+  IN UINTN   Length,\r
+  IN UINT32  Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -126,241 +127,290 @@ SetMem32 (
   Value, and returns Buffer. Value is repeated every 64-bits in for Length\r
   bytes of Buffer.\r
 \r
   Value, and returns Buffer. Value is repeated every 64-bits in for Length\r
   bytes of Buffer.\r
 \r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to fill.\r
-  @param  Length  Number of bytes in Buffer to fill.\r
-  @param  Value   Value with which to fill Length bytes of Buffer.\r
+  @param  Buffer  The pointer to the target buffer to fill.\r
+  @param  Length  The number of bytes in Buffer to fill.\r
+  @param  Value   The value with which to fill Length bytes of Buffer.\r
 \r
 \r
-  @return Buffer\r
+  @return Buffer.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem64 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 SetMem64 (\r
-  OUT     VOID                      *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
+  OUT VOID   *Buffer,\r
+  IN UINTN   Length,\r
+  IN UINT64  Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Set Buffer to 0 for Size bytes.\r
+  Fills a target buffer with a value that is size UINTN, and returns the target buffer.\r
 \r
 \r
-  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+  This function fills Length bytes of Buffer with the UINTN sized value specified by\r
+  Value, and returns Buffer. Value is repeated every sizeof(UINTN) bytes for Length\r
+  bytes of Buffer.\r
 \r
 \r
-  If Buffer is NULL and Length > 0, then ASSERT().\r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+  If Buffer is not aligned on a UINTN boundary, then ASSERT().\r
+  If Length is not aligned on a UINTN boundary, then ASSERT().\r
 \r
 \r
-  @param  Buffer Memory to set.\r
-  @param  Size Number of bytes to set\r
+  @param  Buffer  The pointer to the target buffer to fill.\r
+  @param  Length  The number of bytes in Buffer to fill.\r
+  @param  Value   The value with which to fill Length bytes of Buffer.\r
 \r
 \r
-  @return Buffer\r
+  @return Buffer.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
-ZeroMem (\r
-  OUT     VOID                      *Buffer,\r
-  IN      UINTN                     Length\r
+SetMemN (\r
+  OUT VOID  *Buffer,\r
+  IN UINTN  Length,\r
+  IN UINTN  Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Compares two memory buffers of a given length.\r
+  Fills a target buffer with zeros, and returns the target buffer.\r
 \r
 \r
-  This function compares Length bytes of SourceBuffer to Length bytes of\r
-  DestinationBuffer. If all Length bytes of the two buffers are identical, then\r
-  0 is returned. Otherwise, the value returned is the first mismatched byte in\r
-  SourceBuffer subtracted from the first mismatched byte in DestinationBuffer.\r
+  This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
 \r
-  If DestinationBuffer is NULL and Length > 0, then ASSERT().\r
-  If SourceBuffer is NULL and Length > 0, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then\r
-  ASSERT().\r
-  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\r
+  @param  Buffer      The pointer to the target buffer to fill with zeros.\r
+  @param  Length      The number of bytes in Buffer to fill with zeros.\r
 \r
 \r
-  @param  DestinationBuffer First memory buffer\r
-  @param  SourceBuffer      Second memory buffer\r
-  @param  Length            Length of DestinationBuffer and SourceBuffer memory\r
-                            regions to compare\r
+  @return Buffer.\r
 \r
 \r
-  @retval 0         if DestinationBuffer == SourceBuffer\r
-  @retval Non-zero  if DestinationBuffer != SourceBuffer\r
+**/\r
+VOID *\r
+EFIAPI\r
+ZeroMem (\r
+  OUT VOID  *Buffer,\r
+  IN UINTN  Length\r
+  );\r
+\r
+/**\r
+  Compares the contents of two buffers.\r
+\r
+  This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.\r
+  If all Length bytes of the two buffers are identical, then 0 is returned.  Otherwise, the\r
+  value returned is the first mismatched byte in SourceBuffer subtracted from the first\r
+  mismatched byte in DestinationBuffer.\r
+  \r
+  If Length > 0 and DestinationBuffer is NULL, then ASSERT().\r
+  If Length > 0 and SourceBuffer is NULL, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().\r
+\r
+  @param  DestinationBuffer The pointer to the destination buffer to compare.\r
+  @param  SourceBuffer      The pointer to the source buffer to compare.\r
+  @param  Length            The number of bytes to compare.\r
 \r
 \r
+  @return 0                 All Length bytes of the two buffers are identical.\r
+  @retval Non-zero          The first mismatched byte in SourceBuffer subtracted from the first\r
+                            mismatched byte in DestinationBuffer.\r
+                            \r
 **/\r
 INTN\r
 EFIAPI\r
 CompareMem (\r
 **/\r
 INTN\r
 EFIAPI\r
 CompareMem (\r
-  IN      CONST VOID                *DestinationBuffer,\r
-  IN      CONST VOID                *SourceBuffer,\r
-  IN      UINTN                     Length\r
+  IN CONST VOID  *DestinationBuffer,\r
+  IN CONST VOID  *SourceBuffer,\r
+  IN UINTN       Length\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Scans a target buffer for an 8-bit value, and returns a pointer to the\r
-  matching 8-bit value in the target buffer.\r
-\r
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address for an 8-bit value that matches\r
-  Value. If a match is found, then a pointer to the matching byte in the target\r
-  buffer is returned. If no match is found, then NULL is returned. If Length is\r
-  0, then NULL is returned.\r
+  Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value\r
+  in the target buffer.\r
 \r
 \r
-  If Buffer is NULL, then ASSERT().\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for an 8-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to scan.\r
-  @param  Length  Number of bytes in Buffer to scan.\r
-  @param  Value   Value to search for in the target buffer.\r
+  @param  Buffer      The pointer to the target buffer to scan.\r
+  @param  Length      The number of bytes in Buffer to scan.\r
+  @param  Value       The value to search for in the target buffer.\r
 \r
 \r
-  @return Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
+  @return A pointer to the matching byte in the target buffer, otherwise NULL.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem8 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem8 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT8                     Value\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT8       Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Scans a target buffer for a 16-bit value, and returns a pointer to the\r
-  matching 16-bit value in the target buffer.\r
-\r
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 16-bit increments for a 16-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
+  Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value\r
+  in the target buffer.\r
 \r
 \r
-  If Buffer is NULL, then ASSERT().\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a 16-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to scan.\r
-  @param  Length  Number of bytes in Buffer to scan.\r
-  @param  Value   Value to search for in the target buffer.\r
+  @param  Buffer      The pointer to the target buffer to scan.\r
+  @param  Length      The number of bytes in Buffer to scan.\r
+  @param  Value       The value to search for in the target buffer.\r
 \r
 \r
-  @return Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
+  @return A pointer to the matching byte in the target buffer, otherwise NULL.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem16 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem16 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT16                    Value\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT16      Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Scans a target buffer for a 32-bit value, and returns a pointer to the\r
-  matching 32-bit value in the target buffer.\r
-\r
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 32-bit increments for a 32-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
+  Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value\r
+  in the target buffer.\r
 \r
 \r
-  If Buffer is NULL, then ASSERT().\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a 32-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to scan.\r
-  @param  Length  Number of bytes in Buffer to scan.\r
-  @param  Value   Value to search for in the target buffer.\r
+  @param  Buffer      The pointer to the target buffer to scan.\r
+  @param  Length      The number of bytes in Buffer to scan.\r
+  @param  Value       The value to search for in the target buffer.\r
 \r
 \r
-  @return Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
+  @return A pointer to the matching byte in the target buffer, otherwise NULL.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem32 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem32 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT32                    Value\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT32      Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Scans a target buffer for a 64-bit value, and returns a pointer to the\r
-  matching 64-bit value in the target buffer.\r
-\r
-  This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 64-bit increments for a 64-bit\r
-  value that matches Value. If a match is found, then a pointer to the matching\r
-  value in the target buffer is returned. If no match is found, then NULL is\r
-  returned. If Length is 0, then NULL is returned.\r
+  Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value\r
+  in the target buffer.\r
 \r
 \r
-  If Buffer is NULL, then ASSERT().\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a 64-bit value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to scan.\r
-  @param  Length  Number of bytes in Buffer to scan.\r
-  @param  Value   Value to search for in the target buffer.\r
+  @param  Buffer      The pointer to the target buffer to scan.\r
+  @param  Length      The number of bytes in Buffer to scan.\r
+  @param  Value       The value to search for in the target buffer.\r
 \r
 \r
-  @return Pointer to the first occurrence or NULL if not found.\r
-  @retval NULL  if Length == 0 or Value was not found.\r
+  @return A pointer to the matching byte in the target buffer, otherwise NULL.\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem64 (\r
 \r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanMem64 (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      UINT64                    Value\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINT64      Value\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  This function copies a source GUID to a destination GUID.\r
+  Scans a target buffer for a UINTN sized value, and returns a pointer to the matching \r
+  UINTN sized value in the target buffer.\r
+\r
+  This function searches target the buffer specified by Buffer and Length from the lowest\r
+  address to the highest address for a UINTN sized value that matches Value.  If a match is found,\r
+  then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
+  then NULL is returned.  If Length is 0, then NULL is returned.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a UINTN boundary, then ASSERT().\r
+  If Length is not aligned on a UINTN boundary, then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+  @param  Buffer      The pointer to the target buffer to scan.\r
+  @param  Length      The number of bytes in Buffer to scan.\r
+  @param  Value       The value to search for in the target buffer.\r
 \r
 \r
-  This function copies the contents of the 128-bit GUID specified by SourceGuid\r
-  to DestinationGuid, and returns DestinationGuid.\r
+  @return A pointer to the matching byte in the target buffer, otherwise NULL.\r
 \r
 \r
+**/\r
+VOID *\r
+EFIAPI\r
+ScanMemN (\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN UINTN       Value\r
+  );\r
+  \r
+/**\r
+  Copies a source GUID to a destination GUID.\r
+\r
+  This function copies the contents of the 128-bit GUID specified by SourceGuid to\r
+  DestinationGuid, and returns DestinationGuid.\r
+  \r
   If DestinationGuid is NULL, then ASSERT().\r
   If SourceGuid is NULL, then ASSERT().\r
 \r
   If DestinationGuid is NULL, then ASSERT().\r
   If SourceGuid is NULL, then ASSERT().\r
 \r
-  @param  DestinationGuid Pointer to the destination GUID.\r
-  @param  SourceGuid Pointer to the source GUID.\r
+  @param  DestinationGuid   The pointer to the destination GUID.\r
+  @param  SourceGuid        The pointer to the source GUID.\r
 \r
 \r
-  @return DestinationGuid\r
+  @return DestinationGuid.\r
 \r
 **/\r
 GUID *\r
 EFIAPI\r
 CopyGuid (\r
 \r
 **/\r
 GUID *\r
 EFIAPI\r
 CopyGuid (\r
-  OUT     GUID                      *DestinationGuid,\r
-  IN      CONST GUID                *SourceGuid\r
+  OUT GUID       *DestinationGuid,\r
+  IN CONST GUID  *SourceGuid\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Compares two GUIDs\r
-\r
-  This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE\r
-  is returned. If there are any bit differences in the two GUIDs, then FALSE is\r
-  returned.\r
+  Compares two GUIDs.\r
 \r
 \r
+  This function compares Guid1 to Guid2.  If the GUIDs are identical then TRUE is returned.\r
+  If there are any bit differences in the two GUIDs, then FALSE is returned.\r
+  \r
   If Guid1 is NULL, then ASSERT().\r
   If Guid2 is NULL, then ASSERT().\r
 \r
   If Guid1 is NULL, then ASSERT().\r
   If Guid2 is NULL, then ASSERT().\r
 \r
-  @param  Guid1 guid to compare\r
-  @param  Guid2 guid to compare\r
+  @param  Guid1       A pointer to a 128 bit GUID.\r
+  @param  Guid2       A pointer to a 128 bit GUID.\r
 \r
 \r
-  @retval TRUE  if Guid1 == Guid2\r
-  @retval FALSE if Guid1 != Guid2\r
+  @retval TRUE        Guid1 and Guid2 are identical.\r
+  @retval FALSE       Guid1 and Guid2 are not identical.\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
 CompareGuid (\r
 \r
 **/\r
 BOOLEAN\r
 EFIAPI\r
 CompareGuid (\r
-  IN      CONST GUID                *Guid1,\r
-  IN      CONST GUID                *Guid2\r
+  IN CONST GUID  *Guid1,\r
+  IN CONST GUID  *Guid2\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -368,28 +418,29 @@ CompareGuid (
   in the target buffer.\r
 \r
   This function searches target the buffer specified by Buffer and Length from\r
   in the target buffer.\r
 \r
   This function searches target the buffer specified by Buffer and Length from\r
-  the lowest address to the highest address at 128-bit increments for the\r
-  128-bit GUID value that matches Guid. If a match is found, then a pointer to\r
-  the matching GUID in the target buffer is returned. If no match is found,\r
-  then NULL is returned. If Length is 0, then NULL is returned.\r
-\r
-  If Buffer is NULL, then ASSERT().\r
-  If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
+  the lowest address to the highest address at 128-bit increments for the 128-bit\r
+  GUID value that matches Guid.  If a match is found, then a pointer to the matching\r
+  GUID in the target buffer is returned.  If no match is found, then NULL is returned.\r
+  If Length is 0, then NULL is returned.\r
+  \r
+  If Length > 0 and Buffer is NULL, then ASSERT().\r
+  If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
+  If Length is not aligned on a 128-bit boundary, then ASSERT().\r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
-  @param  Buffer  Pointer to the target buffer to scan.\r
-  @param  Length  Number of bytes in Buffer to scan.\r
-  @param  Guid    Value to search for in the target buffer.\r
+  @param  Buffer  The pointer to the target buffer to scan.\r
+  @param  Length  The number of bytes in Buffer to scan.\r
+  @param  Guid    The value to search for in the target buffer.\r
+\r
+  @return A pointer to the matching Guid in the target buffer, otherwise NULL.\r
 \r
 \r
-  @return Pointer to the first occurrence.\r
-  @retval NULL  if Length == 0 or Guid was not found.\r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanGuid (\r
 **/\r
 VOID *\r
 EFIAPI\r
 ScanGuid (\r
-  IN      CONST VOID                *Buffer,\r
-  IN      UINTN                     Length,\r
-  IN      CONST GUID                *Guid\r
+  IN CONST VOID  *Buffer,\r
+  IN UINTN       Length,\r
+  IN CONST GUID  *Guid\r
   );\r
 \r
 #endif\r
   );\r
 \r
 #endif\r