]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiMemoryLib/ScanMem32Wrapper.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / UefiMemoryLib / ScanMem32Wrapper.c
CommitLineData
dd51a993 1/** @file\r
2 ScanMem32() implementation.\r
3\r
2bfb6009 4 The following BaseMemoryLib instances contain the same copy of this file:\r
dd51a993 5 BaseMemoryLib\r
6 BaseMemoryLibMmx\r
7 BaseMemoryLibSse2\r
8 BaseMemoryLibRepStr\r
2bfb6009
LG
9 BaseMemoryLibOptDxe\r
10 BaseMemoryLibOptPei\r
dd51a993 11 PeiMemoryLib\r
1fef058f 12 UefiMemoryLib\r
dd51a993 13\r
9095d37b 14 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 15 SPDX-License-Identifier: BSD-2-Clause-Patent\r
eb1c78db 16\r
dd51a993 17**/\r
18\r
19#include "MemLibInternals.h"\r
20\r
21/**\r
22 Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value\r
23 in the target buffer.\r
24\r
56385d49 25 This function searches the target buffer specified by Buffer and Length from the lowest\r
dd51a993 26 address to the highest address for a 32-bit value that matches Value. If a match is found,\r
27 then a pointer to the matching byte in the target buffer is returned. If no match is found,\r
28 then NULL is returned. If Length is 0, then NULL is returned.\r
9095d37b 29\r
dd51a993 30 If Length > 0 and Buffer is NULL, then ASSERT().\r
31 If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
32 If Length is not aligned on a 32-bit boundary, then ASSERT().\r
eb1c78db 33 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
dd51a993 34\r
2fc59a00 35 @param Buffer The pointer to the target buffer to scan.\r
36 @param Length The number of bytes in Buffer to scan.\r
37 @param Value The value to search for in the target buffer.\r
dd51a993 38\r
39 @return A pointer to the matching byte in the target buffer or NULL otherwise.\r
40\r
41**/\r
42VOID *\r
43EFIAPI\r
44ScanMem32 (\r
45 IN CONST VOID *Buffer,\r
46 IN UINTN Length,\r
47 IN UINT32 Value\r
48 )\r
49{\r
50 if (Length == 0) {\r
51 return NULL;\r
52 }\r
53\r
54 ASSERT (Buffer != NULL);\r
55 ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0);\r
56 ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));\r
57 ASSERT ((Length & (sizeof (Value) - 1)) == 0);\r
58\r
2f88bd3a 59 return (VOID *)InternalMemScanMem32 (Buffer, Length / sizeof (Value), Value);\r
dd51a993 60}\r