Commit 188984a0 authored by Martin Reinecke's avatar Martin Reinecke

be totally standards compliant if vectorization is disabled

parent 1307970b
......@@ -41,26 +41,28 @@ template<typename T> struct arr
static T *ralloc(size_t num)
{
if (num==0) return nullptr;
#ifdef POCKETFFT_NO_VECTORS
void *res = malloc(num*sizeof(T));
if (!res) throw bad_alloc();
#else
#if 0
return (T *)aligned_alloc(64,num*sizeof(T));
void *res = aligned_alloc(64,num*sizeof(T));
if (!res) throw bad_alloc();
#else
void *res(nullptr);
if (num>0)
if (posix_memalign(&res, 64, num*sizeof(T))!=0)
throw bad_alloc();
return reinterpret_cast<T *>(res);
if (posix_memalign(&res, 64, num*sizeof(T))!=0)
throw bad_alloc();
#endif
#endif
return reinterpret_cast<T *>(res);
}
static void dealloc(T *ptr)
{ free(ptr); }
public:
arr() : p(0), sz(0) {}
arr(size_t n) : p(ralloc(n)), sz(n)
{
if ((!p) && (n!=0))
throw bad_alloc();
}
arr(size_t n) : p(ralloc(n)), sz(n) {}
arr(arr &&other)
: p(other.p), sz(other.sz)
{ other.p=nullptr; other.sz=0; }
......@@ -2065,6 +2067,7 @@ template<size_t N, typename Ti, typename To> class multi_iter
};
#ifndef POCKETFFT_NO_VECTORS
#if (defined(__AVX512F__))
#define HAVE_VECSUPPORT
constexpr int VBYTELEN=64;
......@@ -2075,6 +2078,7 @@ constexpr int VBYTELEN=32;
#define HAVE_VECSUPPORT
constexpr int VBYTELEN=16;
#endif
#endif
#if defined(HAVE_VECSUPPORT)
template<typename T> struct VTYPE{};
......
......@@ -61,7 +61,7 @@ python_module_link_args = []
base_library_link_args = []
if sys.platform == 'darwin':
extra_cc_compile_args.append('--std=c++14')
extra_cc_compile_args.append('--std=c++11')
extra_cc_compile_args.append('--stdlib=libc++')
extra_compile_args.append('-mmacosx-version-min=10.9')
......@@ -73,7 +73,7 @@ if sys.platform == 'darwin':
else:
extra_compile_args += ['-march=native', '-O3', '-Wfatal-errors', '-Wno-ignored-attributes']
python_module_link_args += ['-march=native']
extra_cc_compile_args.append('--std=c++14')
extra_cc_compile_args.append('--std=c++11')
python_module_link_args.append("-Wl,-rpath,$ORIGIN")
extra_cc_compile_args = extra_compile_args + extra_cc_compile_args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment