Hi Rolf.
A good point. The intention (at pascal level) was post-decrement, not pre-decrement. So this is what I would want to do (and nearly can). (I know it is buggy - it is just to give an idea...)
Code
var
ar : array[1..10] of byte;
pa, pb : pointer to byte;
br : array[1..9] of byte;
carry : boolean;
...
pa := @ar[10];
pb := @br[9];
carry := FALSE;
for i := 1 to 9
if carry then
dec( pa^);
endif;
carry := pb^ > pa^;
pa^-- := pa^ - pb^--; // not pa^ := pa^-- - pb^--; !!!
endfor;
But yes, at assembler level efficiency will be reduced because of pre-decrement, so maybe the produced code would be no more efficient than I already have...
Code
var
ar : array[1..10] of byte;
pa, pb : pointer to byte;
br : array[1..9] of byte;
carry : boolean;
...
pa := @ar[10];
pb := @br[9];
carry := FALSE;
for i := 1 to 9
if carry then
dec( pa^);
endif;
carry := pb^ > pa^;
dec( pa^, pb^ );
dec( pa );
dec( pb );
endfor;
Thanks for insight.
Regards
Merlin.