X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/af7a1f70049b8065b17dc500981ab32570f83df2..eabbb166f06996c5f8a04166f9a9e934195e85af:/client/hardnested/hardnested_bitarray_core.c diff --git a/client/hardnested/hardnested_bitarray_core.c b/client/hardnested/hardnested_bitarray_core.c index 5b48a735..320c4a96 100644 --- a/client/hardnested/hardnested_bitarray_core.c +++ b/client/hardnested/hardnested_bitarray_core.c @@ -21,7 +21,9 @@ #include #include #include +#ifndef __APPLE__ #include +#endif // this needs to be compiled several times for each instruction set. // For each instruction set, define a dedicated function name: @@ -143,8 +145,15 @@ count_bitarray_AND4_t count_bitarray_AND4_AVX512, count_bitarray_AND4_AVX2, coun inline uint32_t *MALLOC_BITARRAY(uint32_t x) { -#ifdef _WIN32 +#if defined (_WIN32) return __builtin_assume_aligned(_aligned_malloc((x), __BIGGEST_ALIGNMENT__), __BIGGEST_ALIGNMENT__); +#elif defined (__APPLE__) + uint32_t *allocated_memory; + if (posix_memalign((void**)&allocated_memory, __BIGGEST_ALIGNMENT__, x)) { + return NULL; + } else { + return __builtin_assume_aligned(allocated_memory, __BIGGEST_ALIGNMENT__); + } #else return __builtin_assume_aligned(memalign(__BIGGEST_ALIGNMENT__, (x)), __BIGGEST_ALIGNMENT__); #endif