> Hello,
>
> I wonder if FPC optimize a code such as:
>
> if a < b then
>   c := d
> else
>   c := b;
>
> as :
>
> r := b + ((d - b) and -(a < b));
>
> If so, do you check the type of CPU (because as I understand, some CPU
> will not execute as fast as other CPU's.
>
> If not, then why, and how would you optimize such code ?

This is not a generic optimization that will give real benefits. Your code
also relies on the fact that (a<b) always returns 0 or 1. But this is not
garantueed. A boolean is defined as 0=false and everything else is true.



_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to