c++ - C++11 : Does new return contiguous memory? -
float* tempbuf = new float[maxvoices]();
will above result in
1) memory 16-byte aligned?
2) memory confirmed contiguous?
what want following:
float tempbuf[maxvoices] __attribute__ ((aligned));
but heap memory, effective apple accelerate framework.
thanks.
the memory aligned float
, not cpu-specific simd instructions. suspect on system sizeof(float) < 16
, though, means it's not aligned want. memory contiguous: &a[i] == &a[0] + i
.
if need more specific, new std::aligned_storage<length, alignment>
return suitable region of memory, presuming of course did in fact pass more specific alignment.
another alternative struct fourfloats alignas(16) {float[4] floats;};
- may map more naturally framework. you'd need new fourfloats[(maxvoices+3)/4]
.
Comments
Post a Comment