MCPcopy Create free account
hub / github.com/alibaba/zvec / aligned_malloc

Function aligned_malloc

src/include/zvec/ailego/buffer/concurrentqueue.h:4251–4263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4249
4250 template <typename TAlign>
4251 static inline void *aligned_malloc(size_t size) {
4252 MOODYCAMEL_CONSTEXPR_IF(std::alignment_of<TAlign>::value <=
4253 std::alignment_of<details::max_align_t>::value)
4254 return (Traits::malloc)(size);
4255 else {
4256 size_t alignment = std::alignment_of<TAlign>::value;
4257 void *raw = (Traits::malloc)(size + alignment - 1 + sizeof(void *));
4258 if (!raw) return nullptr;
4259 char *ptr = details::align_for<TAlign>(reinterpret_cast<char *>(raw) +
4260 sizeof(void *));
4261 *(reinterpret_cast<void **>(ptr) - 1) = raw;
4262 return ptr;
4263 }
4264 }
4265
4266 template <typename TAlign>

Callers

nothing calls this directly

Calls 1

MOODYCAMEL_CONSTEXPR_IFFunction · 0.85

Tested by

no test coverage detected