On Tue, Nov 17, 2009 at 12:48 PM, Graeme Geldenhuys
<gra...@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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to