Here is the full implementation of aligned arrays, let me know if it works for you.
https://www.getlazarus.org/arrays/ Here is another example: uses AlignArrays; procedure Test; var VertexData: TAlignedArray<TVec3>; V: PVec3; I: Integer; begin VertexData.Length := 100; // page sized and aligned memory allocated here V := VertexData[0]; // get a reference to the first item for I := 0 to V.Length - 1 do begin V^ := ComputeVertex(I); // write to vertex data faster via a pointer Inc(V); end; for V in VertexData do // array like enumerators are supported PrintVertex(V); V.Item[6] := ComputeVertex(Random(100)); // you can write directly using this syntax V[7]^ := ComputeVertex(Random(100)); // or write by dereferencing the default indexer end; // there is no need to free the memory, it is taken care of for you by finalize
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel