input reallocated to contain newBitCount number of bits. New bits are default-initialized to zero.
enum bitCount = 8*size_t.sizeof + 1; size_t* x = makeUninitializedBitArray!(Allocator)(bitCount); Allocator.instance.deallocate(cast(void[])(x[0 .. wordCountOfBitCount(bitCount)]));
size_t bitCount = 1; size_t* y = makeBitArrayZeroed!(Allocator)(bitCount).ptr; // start empty while (bitCount < 100_000) { const newBitCount = bitCount * 2; y = makeReallocatedBitArrayZeroPadded!(Allocator)(y, bitCount, newBitCount); bitCount = newBitCount; // check contents foreach (immutable bitIndex; 0 .. bitCount) assert(bt(y, bitIndex) == 0); } Allocator.instance.deallocate(cast(void[]) (y[0 .. wordCountOfBitCount(bitCount)]));