Aligned memory allocator. More...
#include <SimdAllocator.hpp>
Static Public Member Functions | |
static SIMD_INLINE void * | Allocate (size_t size, size_t align) |
Allocates aligned memory block. More... | |
static SIMD_INLINE void | Free (void *ptr) |
Frees aligned memory block. More... | |
static SIMD_INLINE size_t | Align (size_t size, size_t align) |
Gets aligned size. More... | |
static SIMD_INLINE void * | Align (void *ptr, size_t align) |
Gets aligned address. More... | |
static SIMD_INLINE size_t | Alignment () |
Gets memory alignment required for the most productive work. More... | |
Detailed Description
template<class T>
struct Simd::Allocator< T >
struct Simd::Allocator< T >
Aligned memory allocator.
Performs allocation and deletion of aligned memory.
- Note
- Also it can be used as an allocator for STL containers.
Member Function Documentation
◆ Allocate()
|
static |
Allocates aligned memory block.
- Note
- The memory allocated by this function is must be deleted by function Simd::Allocator::Free.
- Parameters
-
[in] size - a size of required memory block. [in] align - an align of allocated memory address.
- Returns
- a pointer to allocated memory.
◆ Free()
|
static |
Frees aligned memory block.
- Note
- This function frees a memory allocated by function Simd::Allocator::Allocate.
- Parameters
-
[in] ptr - a pointer to the memory to be deleted.
◆ Align() [1/2]
|
static |
Gets aligned size.
- Parameters
-
[in] size - an original size. [in] align - a required alignment.
- Returns
- an aligned size.
◆ Align() [2/2]
|
static |
Gets aligned address.
- Parameters
-
[in] ptr - an original pointer. [in] align - a required alignment.
- Returns
- an aligned address.
◆ Alignment()
|
static |
Gets memory alignment required for the most productive work.
- Returns
- a required memory alignment.