[Lazarus] RE : RE : Convert assembler to Pascal
Ludo Brands
ludo.brands at free.fr
Tue Sep 13 17:04:07 CEST 2011
> Should have told it was for delphi also:
>
> Procedure XorMemPrim(var Mem1; const Mem2; Count :
> Cardinal); Var i:integer;
> p1,p2:pointer;
> Begin
> p1:=@Mem1;
> p2:=@Mem2;
> for i:=1 to count div 4 do
> begin
> pdword(p1)^:=pdword(p1)^ xor pdword(p2)^;
> p1:=pointer(cardinal(p1)+4);
> p2:=pointer(cardinal(p2)+4);
> end;
> For i:=1 to count mod 4 do
> begin
> pbyte(p1)^:=pbyte(p1)^ xor pbyte(p2)^;
> p1:=pointer(cardinal(p1)+1);
> p2:=pointer(cardinal(p2)+1);
> end;
> End;
>
BTW. Use PtrUint instead of cardinal if you want to port this to 64 bits.
But then it won't compile on Delphi anymore.
Ludo
More information about the Lazarus
mailing list