Article

From:
To:
Robert Lee
Subject:
Re: Cardinality of a set
Newsgroup:
borland.public.delphi.objectpascal

Re: Cardinality of a set

<<Bob:
I don't.  I scan up referened from the back of the array.  Thus i goes
from -size to -1.
>>

Got it!

<<
Anyway, b is free as it will only be a register variable
(optimization on) and you have to load Data[i] sometime.
>>

Got that too. Using b means spelling out what the compiler codes anyhow, and
makes the OP code easier to read.

<<
Another is the use of 'absolute'.
Using absolute as a sort of permanent typecast often forces register
variables onto the stack.  In this case, the data is already memory
based so it works out.
>>

From way back, I see absolute as the normal complement for untyped params.
Can't say your pointer and assignment look like a convincing improvement.

<<
BTW: I really wish they would 'fix' the for loop because I rather
dislike using while to do a for loops job.
>>

Could you go into detail? I don't quite see what the For does worse than
would a While in the same place. The For looks under-optimized because it
sticks to ecx when it already uses a loop var, the While because it doesn't
fully simplify its tests. But you're right that the ecx thing is a somewhat
embarrassing holdover.

    PhR
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Tue, 26 Nov 2024 11:58:03 UTC
Copyright © 2009-2024
HREF Tools Corp.