| 29 | namespace detail { |
| 30 | |
| 31 | void* aligned_alloc(std::size_t size, std::size_t align) |
| 32 | { |
| 33 | #ifdef _WIN32 |
| 34 | void* ptr = _aligned_malloc(size, align); |
| 35 | if (!ptr) |
| 36 | LIBASYNC_THROW(std::bad_alloc()); |
| 37 | return ptr; |
| 38 | #else |
| 39 | void* result; |
| 40 | if (posix_memalign(&result, align, size)) |
| 41 | LIBASYNC_THROW(std::bad_alloc()); |
| 42 | else |
| 43 | return result; |
| 44 | #endif |
| 45 | } |
| 46 | |
| 47 | void aligned_free(void* addr) LIBASYNC_NOEXCEPT |
| 48 | { |
no outgoing calls
no test coverage detected