NewBitArray returns a new bit array. It returns nil if the number of bits is zero.
(bits int)
| 22 | // NewBitArray returns a new bit array. |
| 23 | // It returns nil if the number of bits is zero. |
| 24 | func NewBitArray(bits int) *BitArray { |
| 25 | if bits <= 0 { |
| 26 | return nil |
| 27 | } |
| 28 | return &BitArray{ |
| 29 | Bits: bits, |
| 30 | Elems: make([]uint64, (bits+63)/64), |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | // Size returns the number of bits in the bitarray |
| 35 | func (bA *BitArray) Size() int { |
no outgoing calls