Marco van de Voort wrote:
> In our previous episode, Jonas Maebe said:
>>> Or do we have to allocate more bytes for blocks that are a multiple of 8?
>> FPC's default memory manager even guarantees 16 byte alignment (for vectors).
> 
> So a possible solution is to allocate 16-sizeof(ptruint) bytes more?
> 
> for 32-bit that would mean:
> 
> <12 bytes slack><size><data>
> 

Note that fftw_getmem and fftw_freemem (packages/fftw/src/fftw_s.pas)
already contain the code to allocate always aligned pointer. (They
allocate 15 bytes more for 16-bytes aligmnment, and store the value of
original unaligned pointer to pass it to free.)

One could use these as a workaround, to get aligned pointers from any
GetMem/FreeMem implementation.

Michalis
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to