[fpc-pascal] How to solve "Conversion between ordinals and pointers is not portable"

dmitry boyarintsev skalogryz.lists at gmail.com
Tue Nov 17 10:21:21 CET 2009


Graeme, why don't you use power of the FPC (and it's pointer maths)?
Pascal is language of readable code :)

procedure XorBlock(var InData1, InData2; Size: longword);
var
  b1 : PByte; // in Delphi i'd use PByteArray
  b2 ; PByte;
  i: longword;
begin
  b1:=@InData1;
  b2:=@InData2;
  for i:=0 to size-1 do
    b1[i]:=b1[i] xor b2[i];
end;

But, since we're using 32-bit processors it's more effective to use
32-bit xor (where possible)!

thanks,
dmitry



More information about the fpc-pascal mailing list