include/kernel/mem¶
mem.h¶
Functions¶
-
void *memcpy(void *dest, const void *src, size_t n)¶
Copies memory from one location to another.
- Version
0.0.1
- Author
Sable Ayala
- Date
05/12/2024
- Parameters:
dest – The destination to move memory values (pointer)
src – The source location to move memory from (pointer)
n – The size of the memory to move
-
void *memset(void *s, int c, size_t n)¶
Fill a block of memory with a particular value.
- Version
0.0.1
- Author
Sable Ayala
- Date
05/12/2024
- Parameters:
s – The starting address of memory to be filled
c – The value to be filled
n – The number of bytes to be filled starting from \(s\) to be filled
-
void *memmove(void *dest, const void *src, size_t n)¶
Copy a block of memory from a location to another.
- Version
0.0.1
- Parameters:
dest – Destination of memory block
src – Memory block to move
n – Size of the memory block
-
int memcmp(const void *s1, const void *s2, size_t n)¶
Compate two blocks of memory.
Example usage:
int arr1[] = {1, 2, 3, 4, 5}; int arr2[] = {1, 2, 3, 4, 6}; int result = memcmp(arr1, arr2, sizeof(arr1)); // result != 0
- Version
0.0.1
- Parameters:
s1 – Pointer to LHS block of memory
s2 – Pointer to RHS block of memory
n – The number of bytes to be compared
- Returns:
This function returns <0 if s1 is less than s2, >0 s2 is less than s1 and ==0 if s1 is equivalent to s2