newBitArray returns a new dense BitArray at the specified size. This is a separate private constructor so unit tests don't have to constantly cast the BitArray interface to the concrete type.
(size uint64, args ...bool)
| 361 | // separate private constructor so unit tests don't have to constantly cast the |
| 362 | // BitArray interface to the concrete type. |
| 363 | func newBitArray(size uint64, args ...bool) *bitArray { |
| 364 | i, r := getIndexAndRemainder(size) |
| 365 | if r > 0 { |
| 366 | i++ |
| 367 | } |
| 368 | |
| 369 | ba := &bitArray{ |
| 370 | blocks: make([]block, i), |
| 371 | anyset: false, |
| 372 | } |
| 373 | |
| 374 | if len(args) > 0 && args[0] == true { |
| 375 | for i := uint64(0); i < uint64(len(ba.blocks)); i++ { |
| 376 | ba.blocks[i] = maximumBlock |
| 377 | } |
| 378 | |
| 379 | ba.lowest = 0 |
| 380 | ba.highest = i*s - 1 |
| 381 | ba.anyset = true |
| 382 | } |
| 383 | |
| 384 | return ba |
| 385 | } |
| 386 | |
| 387 | // NewBitArray returns a new BitArray at the specified size. The |
| 388 | // optional arg denotes whether this bitarray should be set to the |
searching dependent graphs…