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

Graeme Geldenhuys graeme at mastermaths.co.za
Tue Nov 17 10:44:54 CET 2009


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

The original code is not mine, I'm simply making it 64-bit friendly and
removing some compiler warnings where possible.

> 
> 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];

         ^      ^        ^
dcpcrypt2.pas(660,9) Error: Array type required

You are the second person to recommend something like this and every
time I get compiler errors. I am using 64-bit FPC 2.4.0-rc1 under Linux.


But yes, your code is indeed more readable. :-)



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

I'm not using 32-bit processors. That's the whole reason for the
modifications to DCPCrypt code - getting it 64-bit compatible.



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list