parse/bitset.c
/* Counts the number of values held in a bit set */
Counts the number of values held in a bit set
Counts the number of values held in a bit set
size_t bscount(Bitset *bs)
{
    size_t i, j, n;
    n = 0;
    for (i = 0; i < bs->nchunks; i++)
        for (j = 0; j < sizeof(size_t)*CHAR_BIT; j++)
            if (bs->chunks[i] & 1ULL << j)
                n++;
    return n;
}
size_t bscount ( Bitset * bs ) { size_t i , j , n ; n = 0 ; for ( i = 0 ; i < bs -> nchunks ; i ++ ) for ( j = 0 ; j < sizeof ( size_t ) * CHAR_BIT ; j ++ ) if ( bs -> chunks [ i ] & 1ULL << j ) n ++ ; return n ; }
Counts the number of values held in a bit set
Counts the number of values held in a bit set