Skip to main content

nstd_core_mem_fill

Function nstd_core_mem_fill 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn nstd_core_mem_fill( buf: *mut NSTDByte, size: NSTDUInt, fill: NSTDByte, )
Available on crate feature core only.
Expand description

Fills the memory buffer buf with byte fill.

§Parameters:

  • NSTDByte *buf - The memory buffer to fill.

  • NSTDUInt size - The size of the memory buffer.

  • NSTDByte fill - The byte value to fill the memory buffer with.

§Safety

This operation can cause undefined behavior if the caller does not ensure that the memory buffer is at least size bytes in size.

§Example

use nstd_sys::core::mem::nstd_core_mem_fill;

unsafe {
    let mut buf = [u8::MAX; 10];
    nstd_core_mem_fill(buf.as_mut_ptr(), 10, 0);
    assert!(buf == [0u8; 10]);
}