Bitmap.countSet

size_t countSet() const @safe pure nothrow

Counts the set bits in the visible range. The count of an empty bitmap is 0; the owner of a sentinel validity bitmap takes its valid count from its own length instead (the sentinel means "all valid").

Returns

the number of set bits, exact over the visible range.