]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMemGeneric.c
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
) {
43 } while (--Length
!= 0);
48 Scans a target buffer for a 32-bit value, and returns a pointer to the
49 matching 32-bit value in the target buffer.
51 @param Buffer The pointer to the target buffer to scan.
52 @param Length The count of 32-bit value to scan. Must be non-zero.
53 @param Value The value to search for in the target buffer.
55 @return The pointer to the first occurrence, or NULL if not found.
60 InternalMemScanMem32 (
61 IN CONST VOID
*Buffer
,
66 CONST UINT32
*Pointer
;
68 Pointer
= (CONST UINT32
*)Buffer
;
70 if (*Pointer
== Value
) {
74 } while (--Length
!= 0);
79 Scans a target buffer for a 64-bit value, and returns a pointer to the
80 matching 64-bit value in the target buffer.
82 @param Buffer The pointer to the target buffer to scan.
83 @param Length The count of 64-bit value to scan. Must be non-zero.
84 @param Value The value to search for in the target buffer.
86 @return The pointer to the first occurrence, or NULL if not found.
91 InternalMemScanMem64 (
92 IN CONST VOID
*Buffer
,
97 CONST UINT64
*Pointer
;
99 Pointer
= (CONST UINT64
*)Buffer
;
101 if (*Pointer
== Value
) {
105 } while (--Length
!= 0);
110 Checks whether the contents of a buffer are all zeros.
112 @param Buffer The pointer to the buffer to be checked.
113 @param Length The size of the buffer (in bytes) to be checked.
115 @retval TRUE Contents of the buffer are all zeros.
116 @retval FALSE Contents of the buffer are not all zeros.
121 InternalMemIsZeroBuffer (
122 IN CONST VOID
*Buffer
,
126 CONST UINT8
*BufferData
;
130 for (Index
= 0; Index
< Length
; Index
++) {
131 if (BufferData
[Index
] != 0) {