void Bitvector::finish_copy_constructor(const Bitvector &o) { int nn = max_word(); _data = new uint32_t[nn + 1]; for (int i = 0; i <= nn; i++) _data[i] = o._data[i]; }
bool bitvector::zero() const { int nn = max_word(); for (int i = 0; i <= nn; i++) if (_data[i]) return false; return true; }
void bitvector::resize_to_max(int new_max, bool valid_n) { int want_u = (new_max >> 5) + 1; int have_u = (valid_n ? max_word() : MAX_INLINE_WORD) + 1; if (have_u < MAX_INLINE_WORD + 1) have_u = MAX_INLINE_WORD + 1; if (want_u <= have_u) return; uint32_t *new_data = new uint32_t[want_u]; memcpy(new_data, _data, have_u * sizeof(uint32_t)); memset(new_data + have_u, 0, (want_u - have_u) * sizeof(uint32_t)); if (_data != &_f0) delete[] _data; _data = new_data; }
void Bitvector::clear() { int nn = max_word(); for (int i = 0; i <= nn; i++) _data[i] = 0; }