def count_overlap( bits1, bits2 ):
    """
    Count the number of bits that overlap between two sets
    """
    b = BitSet( bits1.size )
    b |= bits1
    b &= bits2
    return b.count_range( 0, b.size )