Logo Search packages:      
Sourcecode: lbt version File versions  Download package

bool BitVector::operator== ( const class BitVector other  )  const [inline]

Equality comparison

Parameters:
other other bit vector to compare this against
Returns:
true if the bit vectors are identical, treating missing bits as unset

Definition at line 63 of file BitVector.h.

References getNumWords(), m_bits, and m_size.

                                                       {
    unsigned tsize = getNumWords (m_size), osize = getNumWords (other.m_size);
    if (tsize < osize) {
      if (memcmp (m_bits, other.m_bits, tsize * sizeof (word_t)))
      return false;
      for (register const word_t* bits = other.m_bits + osize;
         bits-- > other.m_bits + tsize; )
      if (*bits)
        return false;
    }
    else {
      if (memcmp (m_bits, other.m_bits, osize * sizeof (word_t)))
      return false;
      for (register const word_t* bits = m_bits + tsize;
         bits-- > m_bits + osize; )
      if (*bits)
        return false;
    }
    return true;
  }


Generated by  Doxygen 1.6.0   Back to index