Core: build on aarch64 with gcc (#24216)

* build on aarch64 with gcc

* Core/aarch64: readability on preprocessor macro

* Core/aarch64: TC C++ codestyle adjustment

(cherry picked from commit ce449f6b53)
This commit is contained in:
daMaex
2020-03-01 20:16:57 +01:00
committed by Shauren
parent 8ec51bf3b6
commit 31efaaac40
2 changed files with 42 additions and 10 deletions

View File

@@ -20,13 +20,43 @@
#include <array>
#include <functional>
#include <random>
#if defined(__aarch64__)
#include <mm_malloc.h>
#else
#include <emmintrin.h>
#endif
#include <ctime>
#if defined(__aarch64__)
#if defined(__clang__)
#include <mm_malloc.h>
#elif defined(__GNUC__)
static __inline__ void *__attribute__((__always_inline__, __nodebug__, __malloc__))
_mm_malloc(size_t __size, size_t __align)
{
if (__align == 1)
{
return malloc(__size);
}
if (!(__align & (__align - 1)) && __align < sizeof(void *))
__align = sizeof(void *);
void *__mallocedMemory;
if (posix_memalign(&__mallocedMemory, __align, __size))
return NULL;
return __mallocedMemory;
}
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_mm_free(void *__p)
{
free(__p);
}
#else
#error aarch64 only on clang and gcc
#endif
#else
#include <emmintrin.h>
#endif
SFMTRand::SFMTRand()
{
std::random_device dev;