cppcore
A small, portable C++ core library
Loading...
Searching...
No Matches
cppcore::MemUtils Class Reference

#include <MemUtils.h>

Public Member Functions

 MemUtils ()=default
 The default class constructor.
 ~MemUtils ()=default
 The class destructor.

Static Public Member Functions

static void clearMemory (void *buffer, size_t size)
 Will clear the given buffer with zero.
static bool isAligned (const void *ptr, size_t align)
 Will return true, if the pointer fits into the alignment.
static const void * alignPtr (void *ptr, size_t extra, size_t align)
 Will align the given pointer.

Detailed Description

Definition at line 46 of file MemUtils.h.

Constructor & Destructor Documentation

◆ MemUtils()

cppcore::MemUtils::MemUtils ( )
default

The default class constructor.

◆ ~MemUtils()

cppcore::MemUtils::~MemUtils ( )
default

The class destructor.

Member Function Documentation

◆ alignPtr()

const void * cppcore::MemUtils::alignPtr ( void * ptr,
size_t extra,
size_t align )
inlinestatic

Will align the given pointer.

Parameters
[in]ptrThe pointer to align.
[in]extraSpace for headers / meta information.
[in]alignThe alignment to check for.
Returns
The aligned pointer.

Definition at line 82 of file MemUtils.h.

References cppcore::align(), and ALIGN_MASK.

◆ clearMemory()

void cppcore::MemUtils::clearMemory ( void * buffer,
size_t size )
static

Will clear the given buffer with zero.

Parameters
[in,out]bufferThe buffer to clear.

Definition at line 27 of file MemUtils.cpp.

◆ isAligned()

bool cppcore::MemUtils::isAligned ( const void * ptr,
size_t align )
inlinestatic

Will return true, if the pointer fits into the alignment.

Parameters
[in]ptrThe pointer to check.
[in]alignThe alignment to check for.
Returns
true if aligned, false if not.

Definition at line 72 of file MemUtils.h.

References cppcore::align().


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