MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / aligned_malloc

Function aligned_malloc

concurrentqueue.h:3601–3613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3599
3600 template<typename TAlign>
3601 static inline void* aligned_malloc(size_t size)
3602 {
3603 MOODYCAMEL_CONSTEXPR_IF (std::alignment_of<TAlign>::value <= std::alignment_of<details::max_align_t>::value)
3604 return (Traits::malloc)(size);
3605 else {
3606 size_t alignment = std::alignment_of<TAlign>::value;
3607 void* raw = (Traits::malloc)(size + alignment - 1 + sizeof(void*));
3608 if (!raw)
3609 return nullptr;
3610 char* ptr = details::align_for<TAlign>(reinterpret_cast<char*>(raw) + sizeof(void*));
3611 *(reinterpret_cast<void**>(ptr) - 1) = raw;
3612 return ptr;
3613 }
3614 }
3615
3616 template<typename TAlign>

Callers

nothing calls this directly

Calls 1

MOODYCAMEL_CONSTEXPR_IFFunction · 0.85

Tested by

no test coverage detected