QMCPACK
aligned_allocator.hpp File Reference
+ Include dependency graph for aligned_allocator.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 qmcplusplus
 helper functions for EinsplineSetBuilder
 

Macros

#define ASSUME_ALIGNED(x)
 

Typedefs

template<class T , size_t ALIGN = QMC_SIMD_ALIGNMENT>
using aligned_allocator = Mallocator< T, ALIGN >
 
template<class T >
using aligned_vector = std::vector< T, aligned_allocator< T > >
 

Functions

template<typename T , size_t ALIGN = QMC_SIMD_ALIGNMENT>
size_t getAlignedSize (size_t n)
 return size in T's of allocated aligned memory More...
 
template<typename T , size_t ALIGN = QMC_SIMD_ALIGNMENT>
size_t getAlignment ()
 

Macro Definition Documentation

◆ ASSUME_ALIGNED

Function Documentation

◆ getAlignedSize()

size_t getAlignedSize ( size_t  n)
inline

return size in T's of allocated aligned memory

Definition at line 42 of file aligned_allocator.hpp.

References qmcplusplus::n.

43 {
44  constexpr size_t ND = ALIGN / sizeof(T);
45  static_assert(ALIGN % sizeof(T) == 0, "getAlignedSize ALIGN must be a multiple of sizeof(T)");
46  return ((n + ND - 1) / ND) * ND;
47 }

◆ getAlignment()

size_t getAlignment ( )
inline

Definition at line 50 of file aligned_allocator.hpp.

51 {
52  static_assert(ALIGN % sizeof(T) == 0, "getAlignedSize ALIGN must be a multiple of sizeof(T)");
53  return ALIGN / sizeof(T);
54 }