This repository has been archived on 2023-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
homepage/content/projects/noxos/docs/codebase/utils/memory.h.md

1.5 KiB

title summary
memory.h basic memory functionalities

memory_copy(source, destination, num) - function (void)

Copies num bytes from source to destination. On linux this function is called memcpy.

memory_set(destination, data, num) - function (void)

Sets num bytes at destination to data. On linux this function is called memset.

memory_compare(a, b, num) - function (bool)

Compares the first num bytes at a and b. Returns false if there is a different byte. Returns true if the data is the same. There is a similar function on linux called memcmp.

memory_allocate(size) - function (void*)

Returns the address to a buffer, that is at least size bytes big. On linux this function is called malloc.

memory_free(address) - function (void)

Free the buffer at address and marks it claimable again , this buffer needs to be a buffer, that was created with memory_allocate. On linux this function is called free.

memory_allocator_init(base) - function (void)

This initializes the heap, where memory_allocate allocates memory.

memory_hexdump(address, num) - function (void)

Logs num bytes from address as 8 byte rows. The data is represented in hexadecimal and ascii.