Simd Library Documentation.

Home | Release Notes | Download | Documentation | Forum | SourceForge | GitHub
Allocator< T > Struct Template Reference

Aligned memory allocator. More...

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 >

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

void * Allocate ( size_t  size,
size_t  align 
)
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.
void Free ( void *  ptr)
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.
size_t Align ( size_t  size,
size_t  align 
)
static

Gets aligned size.

Parameters
[in]size- an original size.
[in]align- a required alignment.
Returns
an aligned size.
void * Align ( void *  ptr,
size_t  align 
)
static

Gets aligned address.

Parameters
[in]ptr- an original pointer.
[in]align- a required alignment.
Returns
an aligned address.
size_t Alignment ( )
static

Gets memory alignment required for the most productive work.

Returns
a required memory alignment.