[fpc-devel] State of SSE/AVX intrinsics

denisgolovan denisgolovan at yandex.ru
Tue Apr 21 13:32:11 CEST 2020



> One thing to be slightly aware of with
> dynamic pointers and alignment. For V: atray
> of Integer etc, make sure you check the
> alignment of V[0], not V. V points to an
> internal structure that is largely opaque,
> while V[0] points to the actual data, which I
> imagine is what you want to pass into VMOVAPS
> etc.
> 
> Gareth aka. Kit

I believe your are wrong here.
For dynamic arrays, service data is located at negative offset and pointer itself _is_ zero element address.

type
   TIntArray = array of Integer;

var v:TIntArray;
begin
   SetLength(v,100);
   Writeln(NativeInt(Pointer(v)) = NativeInt(Pointer(@v[0]))); // always gives true
end.


-- Regards,
Denis Golovan


More information about the fpc-devel mailing list