T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
Aligned Allocation

Description

Functions and classes for aligned memory allocation.

Classes

class  simd::aligned_allocator< T, ALIGN >
 Aligned allocator. More...
 

Functions

void simd::aligned_free (void *ptr)
 Aligned memory deallocation.
 
void * simd::aligned_malloc (size_t alignment, size_t size)
 Aligned memory allocation.
 
void * simd::aligned_malloc (size_t size)
 Aligned memory allocation aligned to NATIVE_SIMD_WIDTH.
 

Class Documentation

◆ simd::aligned_allocator

class simd::aligned_allocator
template<typename T, size_t ALIGN>
class simd::aligned_allocator< T, ALIGN >

Aligned allocator.

This class is an allocator that allocates aligned memory blocks.

This class is meant to be used with std::vector for types that require aligned memory blocks.

Template Parameters
Ttype of the elements in the memory block
ALIGNalignment of the memory block in bytes, default is NATIVE_SIMD_WIDTH

Function Documentation

◆ aligned_free()

void simd::aligned_free ( void * ptr)
inline

Aligned memory deallocation.

This function frees a block of memory that was allocated with aligned_malloc().

Parameters
ptrpointer to the memory block to be freed

◆ aligned_malloc() [1/2]

void * simd::aligned_malloc ( size_t alignment,
size_t size )
inline

Aligned memory allocation.

This function allocates a block of memory of size bytes, aligned to the specified alignment.

The allocated memory must be freed with aligned_free().

Parameters
alignmentalignment of the memory block in bytes
sizesize of the memory block in bytes
Returns
pointer to the allocated memory block
See also
aligned_malloc(size_t)

◆ aligned_malloc() [2/2]

void * simd::aligned_malloc ( size_t size)
inline

Aligned memory allocation aligned to NATIVE_SIMD_WIDTH.

This function allocates a block of memory of size bytes, aligned to NATIVE_SIMD_WIDTH.

The allocated memory must be freed with aligned_free().

Parameters
sizesize of the memory block in bytes
Returns
pointer to the allocated memory block
See also
aligned_malloc(size_t, size_t)