# Revert https://github.com/rakshasa/libtorrent/commit/4d72cdde1a7b3e24c319bd937dfe6b21539a1ec1 --- a/rak/allocators.h +++ b/rak/allocators.h @@ -78,7 +78,13 @@ static pointer alloc_size(size_type size) { // assert(size % LT_SMP_CACHE_BYTES == 0 && "Size must be a multiple of cacheline size"); +#if defined __ANDROID__ && __ANDROID_API__ >= 28 return static_cast(std::aligned_alloc(LT_SMP_CACHE_BYTES, size)); +#else + pointer ptr = NULL; + [[maybe_unused]] int result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size); + return ptr; +#endif } void construct (pointer p, const T& value) { new((void*)p)T(value); }