Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bitvector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,16 @@ namespace bowen
{
if (m_size == m_capacity * WORD_BITS)
{
reserve(m_capacity == 0 ? 1 : m_capacity * 2);
reserve(m_capacity ? m_capacity * WORD_BITS * 2 : WORD_BITS);
}
(*this)[m_size++] = value;
}

void reserve(size_t new_capacity)
{
if (new_capacity > m_capacity)
if (new_capacity > m_capacity * WORD_BITS)
{
size_t new_word_count = num_words(new_capacity * WORD_BITS);
size_t new_word_count = num_words(new_capacity);

BitType *new_data = m_allocator.allocate(new_word_count);
std::copy(m_data, m_data + m_capacity, new_data);
Expand Down