From 6f435bc063840f16b782fd3faa733990cdf3a24e Mon Sep 17 00:00:00 2001 From: juj Date: Thu, 10 Jan 2019 19:00:22 +0200 Subject: Fix build on macOS High Sierra 10.13.1 and Xcode 9.2 (9C40b), which does not have aligned_alloc() (not sure if newer macOS/Xcodes do, or if this an issue with old macOS/Xcode version) (#1862) --- src/support/alloc.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/support/alloc.h') diff --git a/src/support/alloc.h b/src/support/alloc.h index 86c49d2f5..075896694 100644 --- a/src/support/alloc.h +++ b/src/support/alloc.h @@ -37,6 +37,10 @@ inline void* aligned_malloc(size_t align, size_t size) { void* ret = _aligned_malloc(size, align); if (errno == ENOMEM) ret = nullptr; return ret; +#elif defined(__APPLE__) + void *ptr; + int result = posix_memalign(&ptr, align, size); + return result == 0 ? ptr : nullptr; #else return aligned_alloc(align, size); #endif -- cgit v1.2.3