Function nstd_sys::core::mem::nstd_core_mem_zero
source · #[no_mangle]
pub unsafe extern "C" fn nstd_core_mem_zero(
buf: *mut NSTDByte,
size: NSTDUInt
)Available on crate feature
nstd_core only.Expand description
Zeros out a memory buffer.
Parameters:
-
NSTDByte *buf- A pointer to the first byte in the memory buffer. -
NSTDUInt size- The number of bytes to set to 0.
Panics
This operation will panic if size is greater than NSTDInt’s max value.
Safety
The caller must ensure that buf is valid for reads of size contiguous bytes.
Example
use nstd_sys::core::mem::nstd_core_mem_zero;
unsafe {
let mut buf = [i32::MAX; 10];
nstd_core_mem_zero(buf.as_mut_ptr().cast(), core::mem::size_of::<i32>() * 10);
assert!(buf == [0i32; 10]);
}