| 13 | #include <cstdlib> |
| 14 | |
| 15 | void* _aligned_malloc(size_t size, size_t align) |
| 16 | { |
| 17 | pxAssert(align < 0x10000); |
| 18 | #if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9 |
| 19 | return aligned_alloc(align, size); |
| 20 | #else |
| 21 | #ifdef __APPLE__ |
| 22 | // MacOS has a bug where posix_memalign is ridiculously slow on unaligned sizes |
| 23 | // This especially bad on M1s for some reason |
| 24 | size = (size + align - 1) & ~(align - 1); |
| 25 | #endif |
| 26 | void* result = 0; |
| 27 | posix_memalign(&result, align, size); |
| 28 | return result; |
| 29 | #endif |
| 30 | } |
| 31 | |
| 32 | void* pcsx2_aligned_realloc(void* handle, size_t new_size, size_t align, size_t old_size) |
| 33 | { |
no outgoing calls
no test coverage detected