From 1b487b67c9a338aaf20088d8fb337ad689f27dcf Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 1 Jan 2016 13:08:15 -0800 Subject: [PATCH] Why travis doesn't have aligned_alloc but my other two unixes do, ?. --- src/xenia/base/memory.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/xenia/base/memory.h b/src/xenia/base/memory.h index 30b52ef77..05517a8e8 100644 --- a/src/xenia/base/memory.h +++ b/src/xenia/base/memory.h @@ -77,7 +77,11 @@ inline T* AlignedAlloc(size_t alignment) { #if XE_COMPILER_MSVC return reinterpret_cast(_aligned_malloc(sizeof(T), alignment)); #else - return reinterpret_cast(aligned_alloc(alignment, sizeof(T))); + void* ptr = nullptr; + if (posix_memalign(&ptr, alignment, sizeof(T))) { + return nullptr; + } + return reinterpret_cast(ptr); #endif // XE_COMPILER_MSVC }