MCPcopy Create free account
hub / github.com/dblalock/bolt / aligned_alloc

Function aligned_alloc

cpp/src/utils/memory.hpp:47–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template<class T, int AlignBytes=kDefaultAlignBytes>
47static inline T* aligned_alloc(size_t n) {
48 static_assert(AlignBytes == 0 || AlignBytes == kDefaultAlignBytes,
49 "Only AlignBytes values of 0 and kDefaultAlignBytes are supported!");
50 static_assert(EIGEN_DEFAULT_ALIGN_BYTES == AlignBytes,
51 "AlignBytes does not match Eigen default align bytes!");
52 if (AlignBytes == kDefaultAlignBytes) {
53 return Eigen::aligned_allocator<T>{}.allocate(n);
54 } else {
55 return new T[n];
56 }
57}
58template<class T, int AlignBytes=kDefaultAlignBytes>
59static inline void aligned_free(T* p) {
60 static_assert(AlignBytes == 0 || AlignBytes == kDefaultAlignBytes,

Callers

nothing calls this directly

Calls 1

allocateMethod · 0.45

Tested by

no test coverage detected