any hint? should I have to open a bug report? Il 31/10/2013 16:23, Andrea Mauri ha scritto:
Dear All, I am using TBits object but I found some errors using it. Before adding a bugreport to the bugtracker I would be sure that there is nothing that I am doing wrong. Below a small procedure that highlights the wrong behaviour of TBits object.var i, bsize1, bsize2: integer; b1, b2, b3: TBits; s1, s2, s3: string; begin bsize1:= 16; bsize2:= 164; b1:= TBits.Create; b2:= TBits.Create(bsize2); b3:= TBits.Create; for i:= 0 to bsize1 - 1 do b1[i]:= True; b2.OrBits(b1); b3.OrBits(b1); for i:= b1.Size to bsize2 - 1 do b3[i]:= False; if not b2.Equals(b3) then begin s1:= bitstostring(b1); s2:= bitstostring(b2); s3:= bitstostring(b3); end; b1.Free; b2.Free; b3.Free; where bitstostring is a simple function as below: function bitstostring(b:TBits): string; var i: integer; bs: string; begin bs:= ''; for i:= 0 to b.Size - 1 do if b[i] then bs:= bs + '1' else bs:= bs + '0'; Result:= bs; end; What I got is that b2 has set to 1 not only the bits that are 1 in b1 but also some other bits. b2 and b3 should be the same but they are not. I tested it on Win32 using lazarus: Lazarus 1.0.13 r42910M FPC 2.6.2 i386-win32-win32/win64 Could you please let me know if you can reproduce it or if I am doing something wrong? Best regards, Andrea Mauri
_______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
