NewBitArray returns a new bit array. It returns nil if the number of bits is zero.
(bits int)
| 25 | // NewBitArray returns a new bit array. |
| 26 | // It returns nil if the number of bits is zero. |
| 27 | func NewBitArray(bits int) *BitArray { |
| 28 | // Reseed non-deterministically. |
| 29 | tmrand.Reseed() |
| 30 | if bits <= 0 { |
| 31 | return nil |
| 32 | } |
| 33 | return &BitArray{ |
| 34 | Bits: bits, |
| 35 | Elems: make([]uint64, numElems(bits)), |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | // Size returns the number of bits in the bitarray |
| 40 | func (bA *BitArray) Size() int { |
searching dependent graphs…