[fpc-devel] TBits class bug?

Giuliano Colla giuliano.colla at fastwebnet.it
Thu Jan 24 21:17:27 CET 2008


While porting the Delphi Kylix CLX library to fpc, I had errors related 
to Tbits class. Simply lifting the Delphi implementation into the code 
solved the problems.

A quick investigations shows that at least the Size property has a 
different meaning.
While Delphi reports the actual number of allocated bits (i.e. 1-2-3 
etc) FPC reports a fixed value of 31 for 1 to 32 bits allocated, and 
then 63, and so on:

{bits.inc}
function TBits.getSize : longint;
begin
    result := (FSize shl BITSHIFT) - 1;
end;

It seems to me that, besides not being Delphi compatible, this is also 
wrong, because the actual available space size is (FSize shl BITSHIFT) 
not decreased by one.

However FPC implementation makes inconsistent the values returned from 
OpenBit with those obtained reading Size.

Do I miss some point?

Giuliano

-- 
Giuliano Colla

Whenever people agree with me, I always feel I must be wrong (O. Wilde)



More information about the fpc-devel mailing list