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

void BitVector::setSize ( unsigned  size  )  [inline]

Set the size of the vector

Parameters:
size the new size of the vector

Definition at line 93 of file BitVector.h.

References getNumWords(), m_allocated, m_bits, and m_size.

Referenced by assign_true(), and BitVector().

                               {
    const unsigned numWords = getNumWords (size);
    if (m_allocated < numWords) {
      while (m_allocated < numWords)
      m_allocated <<= 1;
      word_t* bits = new word_t[m_allocated];
      const unsigned init = getNumWords (m_size);
      memcpy (bits, m_bits, init * sizeof *m_bits);
      memset (bits + init, 0, (m_allocated - init) * sizeof *m_bits);
      delete[] m_bits;
      m_bits = bits;
    }
    m_size = size;
  }


Generated by  Doxygen 1.6.0   Back to index