29 #ifndef VC_COMMON_MALLOC_H_ 
   30 #define VC_COMMON_MALLOC_H_ 
   32 #ifndef Vc_VECTOR_DECLARED_ 
   33 #error "Incorrect inclusion order. This header must be included from Vc/vector.h only." 
   36 #if defined _WIN32 || defined _WIN64 
   44 namespace Vc_VERSIONED_NAMESPACE
 
   49 template <
size_t X> 
static constexpr 
size_t nextMultipleOf(
size_t value)
 
   51     return (value % X) > 0 ? value + X - (value % X) : value;
 
   54 template <std::
size_t alignment> Vc_INTRINSIC 
void *aligned_malloc(std::size_t n)
 
   57     return _mm_malloc(nextMultipleOf<alignment>(n), alignment);
 
   60     return __mingw_aligned_malloc(nextMultipleOf<alignment>(n), alignment);
 
   62     return _aligned_malloc(nextMultipleOf<alignment>(n), alignment);
 
   66     if (0 == posix_memalign(&ptr, alignment < 
sizeof(
void *) ? 
sizeof(
void *) : alignment,
 
   67                             nextMultipleOf<alignment>(n))) {
 
   74 template <Vc::MallocAlignment A> Vc_ALWAYS_INLINE 
void *
malloc(
size_t n)
 
   78         return aligned_malloc<Vc::VectorAlignment>(n);
 
   81         return aligned_malloc<64>(n);
 
   84         return aligned_malloc<4096>(n);
 
   89 Vc_ALWAYS_INLINE 
void free(
void *p)
 
  101 #endif // VC_COMMON_MALLOC_H_ 
void free(T *p)
Frees memory that was allocated with Vc::malloc. 
Align on boundary of page sizes (e.g. 
Align on boundary of cache line sizes (e.g. 
T * malloc(size_t n)
Allocates memory on the Heap with alignment and padding suitable for vectorized access. 
Align on boundary of vector sizes (e.g.