[fpc-devel] Bit manipulation as optimization in FPC

Daniël Mantione daniel.mantione at freepascal.org
Thu Sep 7 08:59:10 CEST 2006



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<b) always returns 0 or 1. But this is 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 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 values (false, true)

Well, the last minute change in 2.0.4 by Florian was needed because 
constructors return non-1 true cases, i.e.:

if constructor_call then

... results actuall a pointer to the object, or nil.

Daniël


More information about the fpc-devel mailing list