BitLen returns the number of bits stored.
()
| 74 | |
| 75 | // BitLen returns the number of bits stored. |
| 76 | func (d BitArray) BitLen() uint { |
| 77 | if len(d.words) == 0 { |
| 78 | return 0 |
| 79 | } |
| 80 | return d.nonEmptyBitLen() |
| 81 | } |
| 82 | |
| 83 | func (d BitArray) nonEmptyBitLen() uint { |
| 84 | return uint(len(d.words)-1)*numBitsPerWord + uint(d.lastBitsUsed) |
no test coverage detected