The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
memory.h File Reference
#include "stdint.h"

Go to the source code of this file.

Functions

void * memcpy (void *dest, const void *src, size_t count)
 copy memory from source to destination.
void * memmove (void *dest, const void *src, size_t count)
 move memory from source to destination, allowing for overlapping regions.
void * memset (void *dest, int value, size_t count)
 set a block of memory to a specific value.
int memcmp (const void *lhs, const void *rhs, size_t count)
 compare two blocks of memory.

Function Documentation

◆ memcpy()

void * memcpy ( void * dest,
const void * src,
size_t count )

copy memory from source to destination.

copies n bytes from memory area src to memory area dst.

Parameters
destdestination buffer.
srcsource buffer.
countnumber of bytes to copy.
Returns
pointer to the destination buffer.

The memory areas must not overlap.

Parameters
dstthe destination memory area.
srcthe source memory area.
nthe number of bytes to copy.
Returns
a pointer to the destination memory area dst.

◆ memmove()

void * memmove ( void * dest,
const void * src,
size_t count )

move memory from source to destination, allowing for overlapping regions.

copies n bytes from memory area src to memory area dst.

Parameters
destdestination buffer.
srcsource buffer.
countnumber of bytes to move.
Returns
pointer to the destination buffer.

The memory areas may overlap.

Parameters
dstthe destination memory area.
srcthe source memory area.
nthe number of bytes to copy.
Returns
a pointer to the destination memory area dst.

◆ memset()

void * memset ( void * dest,
int value,
size_t count )

set a block of memory to a specific value.

fills the first n bytes of the memory area pointed to by dst with the constant byte c.

Parameters
destdestination buffer.
valuevalue to set each byte to.
countnumber of bytes to set.
Returns
pointer to the destination buffer.
Parameters
dstthe memory area to fill.
cthe byte to fill the memory area with.
nthe number of bytes to fill.
Returns
a pointer to the memory area dst.

◆ memcmp()

int memcmp ( const void * lhs,
const void * rhs,
size_t count )

compare two blocks of memory.

compares the first n bytes of the memory areas s1 and s2.

Parameters
lhsleft hand side buffer.
rhsright hand side buffer.
countnumber of bytes to compare.
Returns
negative if lhs < rhs, 0 if lhs == rhs, positive if lhs > rhs.
Parameters
s1the first memory area to compare.
s2the second memory area to compare.
nthe number of bytes to compare.
Returns
an integer less than, equal to, or greater than zero if the first n bytes of s1 are found, respectively, to be less than, to match, or be greater than the first n bytes of s2.