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

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


On Tue, Nov 17, 2009 at 12:48 PM, Graeme Geldenhuys
<graeme at mastermaths.co.za> wrote:
> Changing those declarations to PByteArray type solves the compiler error
> in FPC.
Seems like {$mode delphi} is used.

here's faster version of xorblock

procedure XorBlockEx(var InData1, InData2; Size: longword);
var
  l1 : PIntegerArray;
  l2 : PIntegerArray;
  b1 : PByteArray;
  b2 : PByteArray;
  i  : integer;
  c  : integer;
begin
  l1:=@inData1;
  l2:=@inData2;
  for i:=0 to size div sizeof(LongWord)-1 do
    l1[i]:=l1[i] xor l2[i];

  // the rest of the buffer (3 bytes)
  c:=size mod sizeof(longWord);
  if c>0 then begin
    b1:=@InData1;
    b2:=@InData2;
    for i:=(size-c) to size-1 do b1[i]:=b1[i] xor b2[i];
  end;
end;

thanks,
dmitry



More information about the fpc-pascal mailing list