hollyhock
Functions
mem.hpp File Reference

Functions used for modifying and allocating memory. More...

#include <stdint.h>
Include dependency graph for mem.hpp:

Go to the source code of this file.

Functions

void free (void *ptr)
 
void * malloc (uint32_t size)
 
void * memcpy (void *destination, const void *source, int num)
 
void * memset (void *ptr, int value, int num)
 

Detailed Description

Functions used for modifying and allocating memory.

Similar to the memory functions provided by the C standard library.

Function Documentation

◆ free()

void free ( void *  ptr)

Frees memory allocated by malloc, allowing it to be reused.

Parameters
ptrThe pointer to the allocated region of memory to free.

◆ malloc()

void* malloc ( uint32_t  size)

Allocates size bytes of memory.

The current application crashes if the memory cannot be allocated.

Parameters
sizeThe number of bytes of memory to allocate.
Returns
A pointer to the allocated memory region.

◆ memcpy()

void* memcpy ( void *  destination,
const void *  source,
int  num 
)

Copies one region of memory to another. Equivalent to the C standard library function with the same name.

Copies num bytes from source to destination.

Parameters
[out]destinationA pointer to the destination of the copy.
[in]sourceA pointer to the source for the copy.
numThe number of bytes to copy.
Returns
destination

◆ memset()

void* memset ( void *  ptr,
int  value,
int  num 
)

Sets a region of memory to a specific value. Equivalent to the C standard library function with the same name.

Fills the region pointed to by ptr with num bytes of value value (zero-extended to a byte).

Parameters
[out]ptrA pointer to the region of memory to fill.
valueThe value to fill the memory region with.
numThe number of bytes to fill.
Returns
ptr