Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-07 Thread Florian Klaempfl
Jonas Maebe wrote: > > On 7 sep 2006, at 08:59, Daniël Mantione wrote: > >>> Afaik only in case of reading a boolean everything <> 0 is true (for >>> compatibility with other languages). In case of writing, Pascal (and >>> FPC in >>> particular) always stores a 1 for true and 0 for false, since b

Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-07 Thread Jonas Maebe
On 7 sep 2006, at 08:59, Daniël Mantione wrote: Afaik only in case of reading a boolean everything <> 0 is true (for compatibility with other languages). In case of writing, Pascal (and FPC in particular) always stores a 1 for true and 0 for false, since boolean is defined as an enum with

Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-06 Thread Daniël Mantione
Op Thu, 7 Sep 2006, schreef Jonas Maebe: > > On 7 sep 2006, at 07:52, Peter Vreman wrote: > > > This is not a generic optimization that will give real benefits. Your > > code > > also relies on the fact that (a > garantueed. A boolean is defined as 0=false and everything else is true. > > Afa

Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-06 Thread Jonas Maebe
On 7 sep 2006, at 07:52, Peter Vreman wrote: This is not a generic optimization that will give real benefits. Your code also relies on the fact that (ais not garantueed. A boolean is defined as 0=false and everything else is true. Afaik only in case of reading a boolean everything <> 0 is

Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-06 Thread Peter Vreman
> 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 wou

Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-06 Thread Florian Klaempfl
Daniël Mantione schrieb: Op Wed, 6 Sep 2006, schreef ik: 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.

Re: [fpc-devel] Bit manipulation as optimization in FPC

2006-09-06 Thread Daniël Mantione
Op Wed, 6 Sep 2006, schreef ik: > 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

[fpc-devel] Bit manipulation as optimization in FPC

2006-09-06 Thread ik
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 ?