| 446 | #ifndef DAS_ALIGNED_ALLOC |
| 447 | #define DAS_ALIGNED_ALLOC 1 |
| 448 | inline void *das_aligned_alloc16(size_t size) { |
| 449 | DAS_ASSERTF(size != 0, "das_aligned_alloc16 called with size 0"); |
| 450 | void *p; |
| 451 | #if defined(_WIN32) |
| 452 | // All Windows toolchains (MSVC / clang-cl / clang-mingw64 / gcc-mingw64) use |
| 453 | // the MS C runtime aligned-allocator family declared in <malloc.h>. |
| 454 | p = _aligned_malloc(size, 16); |
| 455 | #else |
| 456 | p = nullptr; |
| 457 | if (posix_memalign(&p, 16, size)) { |
| 458 | DAS_ASSERTF(0, "posix_memalign returned nullptr"); |
| 459 | return nullptr; |
| 460 | } |
| 461 | #endif |
| 462 | das::track_alloc_hook(p, size); |
| 463 | return p; |
| 464 | } |
| 465 | inline void das_aligned_free16(void *ptr) { |
| 466 | das::track_free_hook(ptr); |
| 467 | #if defined(_WIN32) |
no test coverage detected