Common/FIFOQueue: Use posix_memalign instead of memalign

This commit is contained in:
Connor McLaughlin 2020-02-15 00:08:56 +09:00
parent 23c8a5588d
commit 33f3ab4d86

View file

@ -5,7 +5,11 @@
#include <cstring>
#include <type_traits>
#include <malloc.h> // _aligned_malloc, memalign
#ifdef _MSC_VER
#include <malloc.h> // _aligned_malloc
#else
#include <stdlib.h> // posix_memalign
#endif
template<typename T, u32 CAPACITY>
class FIFOQueue
@ -183,7 +187,8 @@ public:
#ifdef _MSC_VER
this->m_ptr = static_cast<T*>(_aligned_malloc(sizeof(T) * CAPACITY, ALIGNMENT));
#else
this->m_ptr = static_cast<T*>(memalign(ALIGNMENT, sizeof(T) * CAPACITY));
if (posix_memalign(reinterpret_cast<void**>(&this->m_ptr), ALIGNMENT, sizeof(T) * CAPACITY) != 0)
this->m_ptr = nullptr;
#endif
}
else