Re: [fpc-devel] tbits.NotBits

2017-04-13 Thread Mattias Gaertner
On Thu, 13 Apr 2017 11:28:20 +0200 Andrea Mauri wrote: >[...] > procedure TBits.Setall; > var > loop : longint; > begin > for loop := 0 to FSize - 1 do >FBits^[loop] := 1; Should be FBits^[loop] := not cardinal(0); > end; Btw, it seems TBits misses

Re: [fpc-devel] tbits.NotBits

2017-04-13 Thread Andrea Mauri
AFAIK a.NotBits(b) means (a and not b): a b result 0 0 0 0 1 0 1 0 1 1 1 0 Mattias Thank you Mattias. It works as you described. Anyway, since ClearAll, AndBits, OrBits etc works iterating on FBits : ^TBitArray; they are much faster then the simple iteration along property property Bits[Bit:

Re: [fpc-devel] tbits.NotBits

2017-04-13 Thread Mattias Gaertner
On Thu, 13 Apr 2017 10:52:44 +0200 (CEST) Michael Van Canneyt wrote: >[...] > I am not sure that what you did is supported. > > b.notbits(b) > > I am not sure that you can pass the same instance to b. Just look at the code. It's only a few lines. It is supported.

Re: [fpc-devel] tbits.NotBits

2017-04-13 Thread Michael Van Canneyt
On Thu, 13 Apr 2017, Andrea Mauri wrote: any answer? I asked in the wrong place? where should I ask? You asked in the right place. I just didn't notice your first mail. I am not sure that what you did is supported. b.notbits(b) I am not sure that you can pass the same instance to b. Can

Re: [fpc-devel] tbits.NotBits

2017-04-13 Thread Mattias Gaertner
On Fri, 31 Mar 2017 14:07:09 +0200 Andrea Mauri wrote: > I didn't understand how TBits.NotBits works. AFAIK a.NotBits(b) means (a and not b): a b result 0 0 0 0 1 0 1 0 1 1 1 0 Mattias ___ fpc-devel maillist -

Re: [fpc-devel] tbits.NotBits

2017-04-13 Thread Andrea Mauri
any answer? I asked in the wrong place? where should I ask? Il 31/03/2017 14:10, Andrea Mauri ha scritto: one more thing. there is a method like clearall to set all bits to 1? clearall is much more faster then a simple iteration along all bits Il 31/03/2017 14:07, Andrea Mauri ha scritto: I

Re: [fpc-devel] tbits.NotBits

2017-03-31 Thread Andrea Mauri
one last thing, using TBits it is possible to SetIndex in order to start from a predefined index when using FindNextBit and FindPrevBit Anyway it is possible to set the State only using FindFirstBit, so I cannot use FindNextBit only using SetIndex but I have to call also FindFirstBit. Is it

Re: [fpc-devel] tbits.NotBits

2017-03-31 Thread Andrea Mauri
one more thing. there is a method like clearall to set all bits to 1? clearall is much more faster then a simple iteration along all bits Il 31/03/2017 14:07, Andrea Mauri ha scritto: I didn't understand how TBits.NotBits works. Consider the following code: b:= TBits.Create(NRECORDS);