Documentation 6b54b78464
Loading...
Searching...
No Matches
MemoryAllocation Namespace Reference

Functions

constexpr bool is_power_of_two (size_t x)
 
constexpr size_t round_up (size_t multiple, size_t x)
 
template<class T , bool ZeroInit = false>
T * aligned_alloc (size_t alignment, size_t size) noexcept
 Aligned memory allocation compatible across platforms.
 
template<class T >
void aligned_free (T *ptr) noexcept
 Free memory allocated with su2::aligned_alloc.
 

Function Documentation

◆ aligned_alloc()

template<class T , bool ZeroInit = false>
T * MemoryAllocation::aligned_alloc ( size_t  alignment,
size_t  size 
)
inlinenoexcept

Aligned memory allocation compatible across platforms.

Parameters
[in]alignment,inbytes, of the memory being allocated.
[in]size,alsoin bytes.
Template Parameters
ZeroInit,initializememory to 0.
Returns
Pointer to memory, always use su2::aligned_free to deallocate.

◆ aligned_free()

template<class T >
void MemoryAllocation::aligned_free ( T *  ptr)
inlinenoexcept

Free memory allocated with su2::aligned_alloc.

Parameters
[in]ptr,pointerto memory we want to release.

◆ is_power_of_two()

constexpr bool MemoryAllocation::is_power_of_two ( size_t  x)
inlineconstexpr

◆ round_up()

constexpr size_t MemoryAllocation::round_up ( size_t  multiple,
size_t  x 
)
inlineconstexpr