The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
memory.h
Go to the documentation of this file.
1#pragma once
2
3#include "stdint.h"
4
5/**
6 * copy memory from source to destination.
7 * @param dest destination buffer.
8 * @param src source buffer.
9 * @param count number of bytes to copy.
10 * @return pointer to the destination buffer.
11 */
12void *memcpy(void *dest, const void *src, size_t count);
13
14/**
15 * move memory from source to destination, allowing for overlapping regions.
16 * @param dest destination buffer.
17 * @param src source buffer.
18 * @param count number of bytes to move.
19 * @return pointer to the destination buffer.
20 */
21void *memmove(void *dest, const void *src, size_t count);
22
23/**
24 * set a block of memory to a specific value.
25 * @param dest destination buffer.
26 * @param value value to set each byte to.
27 * @param count number of bytes to set.
28 * @return pointer to the destination buffer.
29 */
30void *memset(void *dest, int value, size_t count);
31
32/**
33 * compare two blocks of memory.
34 * @param lhs left hand side buffer.
35 * @param rhs right hand side buffer.
36 * @param count number of bytes to compare.
37 * @return negative if lhs < rhs, 0 if lhs == rhs, positive if lhs > rhs.
38 */
39int memcmp(const void *lhs, const void *rhs, size_t count);
void * memmove(void *dst, const void *src, size_t n)
copies n bytes from memory area src to memory area dst.
Definition memory.c:16
int memcmp(const void *s1, const void *s2, size_t n)
compares the first n bytes of the memory areas s1 and s2.
Definition memory.c:62
void * memset(void *dst, int c, size_t n)
fills the first n bytes of the memory area pointed to by dst with the constant byte c.
Definition memory.c:50
void * memcpy(void *dst, const void *src, size_t n)
copies n bytes from memory area src to memory area dst.
Definition memory.c:3