GATE
gate::Mem Struct Reference

Generic memory allocation functions. More...

#include <memalloc.hpp>

Static Public Member Functions

static void * alloc (size_t sz) noexcept
 
static void * realloc (void *ptr, size_t newsz) noexcept
 
static void dealloc (void *ptr) noexcept
 
static void * copy (void *dst, void const *src, size_t sz) noexcept
 
static void * move (void *dst, void const *src, size_t sz) noexcept
 
static void clear (void *ptr, size_t size) noexcept
 
static void fill (void *ptr, char chr, size_t count) noexcept
 
static intptr_t compare (void const *ptr1, void const *ptr2, size_t sz) noexcept
 
static void reverse (void *ptr, size_t sz) noexcept
 
static void * copyReverse (void *dst, void const *src, size_t sz) noexcept
 
template<class T >
static void clear (T &dataRef) noexcept
 
template<class T >
static void copy (T &dst, T const &src) noexcept
 
template<class T >
static void move (T &dst, T const &src) noexcept
 
template<class T >
static intptr_t compare (T const &ref1, T const &ref2) noexcept
 

Detailed Description

Generic memory allocation functions.

Member Function Documentation

◆ alloc()

void * gate::Mem::alloc ( size_t sz)
staticnoexcept

Allocates the given amount of bytes from process heap

◆ clear()

void gate::Mem::clear ( void * ptr,
size_t size )
staticnoexcept

Clears all bits a given range of memory (overwrites with zero)

◆ compare()

intptr_t gate::Mem::compare ( void const * ptr1,
void const * ptr2,
size_t sz )
staticnoexcept

Compares two memory blocks and returns: -1 if first is small, +1 if second is small, 0 if both are equal

◆ copy()

void * gate::Mem::copy ( void * dst,
void const * src,
size_t sz )
staticnoexcept

Copies a block of memory from a source to a destination address

◆ copyReverse()

void * gate::Mem::copyReverse ( void * dst,
void const * src,
size_t sz )
staticnoexcept

Copies bytes from source to destination buffer in reverse order (dst first byte == src last byte)

◆ dealloc()

void gate::Mem::dealloc ( void * ptr)
staticnoexcept

Deallocates a memory block from process heap

◆ fill()

void gate::Mem::fill ( void * ptr,
char chr,
size_t count )
staticnoexcept

Fills all bytes in a given range of memory with a specific char value

◆ move()

void * gate::Mem::move ( void * dst,
void const * src,
size_t sz )
staticnoexcept

Copies a block of memory by handling overlapping areas

◆ realloc()

void * gate::Mem::realloc ( void * ptr,
size_t newsz )
staticnoexcept

Reallocates a memory block to the given amount of bytes

◆ reverse()

void gate::Mem::reverse ( void * ptr,
size_t sz )
staticnoexcept

Reverses all bytes in a memory block, [1,2,3] -> [3,2,1]


The documentation for this struct was generated from the following files: