Merge branch 'main' into dev

This commit is contained in:
MihailRis 2026-10-27 13:03:13 +03:00
commit 575bfb28e0
14 changed files with 95 additions and 31 deletions

View file

@ -7,6 +7,14 @@
#if defined(_WIN32)
#include <malloc.h>
#elif defined(__ANDROID__)
static inline void* aligned_alloc(size_t alignment, size_t size) {
void* ptr = nullptr;
if (posix_memalign(&ptr, alignment, size) != 0) {
return nullptr;
}
return ptr;
}
#endif
namespace util {
@ -63,6 +71,8 @@ namespace util {
std::unique_ptr<void, AlignedDeleter> ptr(
#if defined(_WIN32)
_aligned_malloc(sizeof(T), alignof(T))
#elif defined(__ANDROID__)
aligned_alloc(sizeof(T), alignof(T))
#else
std::aligned_alloc(alignof(T), sizeof(T))
#endif