I wonder if there's any incentive to have such a feature in-built in the
compiler.  The bounty on #34031 has probably expired by now.  If not,
then your unit would be a great addition.
 Page-aligned memory is probably something that warrants further discussion
with the core team.

 Gareth aka. Kit

 On Fri 29/03/19 05:01 , "Anthony Walter" sys...@gmail.com sent:
 Here is the full implementation of aligned arrays, let me know if it works
for you.
 https://www.getlazarus.org/arrays/ [1]

 Here is another example:
 uses  AlignArrays;
  procedure Test;var
   VertexData: TAlignedArray;  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
  

Links:
------
[1] https://www.getlazarus.org/arrays/
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to