| 4232 | |
| 4233 | template <typename TAlign> |
| 4234 | static inline void* aligned_malloc(size_t size) { |
| 4235 | MOODYCAMEL_CONSTEXPR_IF(std::alignment_of<TAlign>::value <= |
| 4236 | std::alignment_of<details::max_align_t>::value) |
| 4237 | return (Traits::malloc)(size); |
| 4238 | else { |
| 4239 | size_t alignment = std::alignment_of<TAlign>::value; |
| 4240 | void* raw = (Traits::malloc)(size + alignment - 1 + sizeof(void*)); |
| 4241 | if (!raw) |
| 4242 | return nullptr; |
| 4243 | char* ptr = details::align_for<TAlign>(reinterpret_cast<char*>(raw) + |
| 4244 | sizeof(void*)); |
| 4245 | *(reinterpret_cast<void**>(ptr) - 1) = raw; |
| 4246 | return ptr; |
| 4247 | } |
| 4248 | } |
| 4249 | |
| 4250 | template <typename TAlign> |
nothing calls this directly
no test coverage detected