Common/FIFOQueue: Use posix_memalign instead of memalign
This commit is contained in:
parent
23c8a5588d
commit
33f3ab4d86
|
@ -5,7 +5,11 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <type_traits>
|
#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>
|
template<typename T, u32 CAPACITY>
|
||||||
class FIFOQueue
|
class FIFOQueue
|
||||||
|
@ -183,7 +187,8 @@ public:
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
this->m_ptr = static_cast<T*>(_aligned_malloc(sizeof(T) * CAPACITY, ALIGNMENT));
|
this->m_ptr = static_cast<T*>(_aligned_malloc(sizeof(T) * CAPACITY, ALIGNMENT));
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue