]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c
173782ec3d1732d92380240ec0f420155051adbc
2 Architecture Independent Base Memory Library Implementation.
4 The following BaseMemoryLib instances contain the same copy of this file:
9 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
10 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include "../MemLibInternals.h"
17 Scans a target buffer for a 16-bit value, and returns a pointer to the
18 matching 16-bit value in the target buffer.
20 @param Buffer The pointer to the target buffer to scan.
21 @param Length The count of 16-bit value to scan. Must be non-zero.
22 @param Value The value to search for in the target buffer.
24 @return The pointer to the first occurrence, or NULL if not found.
29 InternalMemScanMem16 (
30 IN CONST VOID
*Buffer
,
35 CONST UINT16
*Pointer
;
37 Pointer
= (CONST UINT16
*)Buffer
;
39 if (*Pointer
== Value
) {
44 } while (--Length
!= 0);
50 Scans a target buffer for a 32-bit value, and returns a pointer to the
51 matching 32-bit value in the target buffer.
53 @param Buffer The pointer to the target buffer to scan.
54 @param Length The count of 32-bit value to scan. Must be non-zero.
55 @param Value The value to search for in the target buffer.
57 @return The pointer to the first occurrence, or NULL if not found.
62 InternalMemScanMem32 (
63 IN CONST VOID
*Buffer
,
68 CONST UINT32
*Pointer
;
70 Pointer
= (CONST UINT32
*)Buffer
;
72 if (*Pointer
== Value
) {
77 } while (--Length
!= 0);
83 Scans a target buffer for a 64-bit value, and returns a pointer to the
84 matching 64-bit value in the target buffer.
86 @param Buffer The pointer to the target buffer to scan.
87 @param Length The count of 64-bit value to scan. Must be non-zero.
88 @param Value The value to search for in the target buffer.
90 @return The pointer to the first occurrence, or NULL if not found.
95 InternalMemScanMem64 (
96 IN CONST VOID
*Buffer
,
101 CONST UINT64
*Pointer
;
103 Pointer
= (CONST UINT64
*)Buffer
;
105 if (*Pointer
== Value
) {
110 } while (--Length
!= 0);
116 Checks whether the contents of a buffer are all zeros.
118 @param Buffer The pointer to the buffer to be checked.
119 @param Length The size of the buffer (in bytes) to be checked.
121 @retval TRUE Contents of the buffer are all zeros.
122 @retval FALSE Contents of the buffer are not all zeros.
127 InternalMemIsZeroBuffer (
128 IN CONST VOID
*Buffer
,
132 CONST UINT8
*BufferData
;
136 for (Index
= 0; Index
< Length
; Index
++) {
137 if (BufferData
[Index
] != 0) {