Why travis doesn't have aligned_alloc but my other two unixes do, ?.

This commit is contained in:
Ben Vanik 2016-01-01 13:08:15 -08:00
parent 09aa3179fb
commit 1b487b67c9
1 changed files with 5 additions and 1 deletions

View File

@ -77,7 +77,11 @@ inline T* AlignedAlloc(size_t alignment) {
#if XE_COMPILER_MSVC #if XE_COMPILER_MSVC
return reinterpret_cast<T*>(_aligned_malloc(sizeof(T), alignment)); return reinterpret_cast<T*>(_aligned_malloc(sizeof(T), alignment));
#else #else
return reinterpret_cast<T*>(aligned_alloc(alignment, sizeof(T))); void* ptr = nullptr;
if (posix_memalign(&ptr, alignment, sizeof(T))) {
return nullptr;
}
return reinterpret_cast<T*>(ptr);
#endif // XE_COMPILER_MSVC #endif // XE_COMPILER_MSVC
} }