We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 04b1f16 + 431a643 commit 9fe2927Copy full SHA for 9fe2927
1 file changed
bitvector.hpp
@@ -356,16 +356,16 @@ namespace bowen
356
{
357
if (m_size == m_capacity * WORD_BITS)
358
359
- reserve(m_capacity == 0 ? 1 : m_capacity * 2);
+ reserve(m_capacity ? m_capacity * WORD_BITS * 2 : WORD_BITS);
360
}
361
(*this)[m_size++] = value;
362
363
364
void reserve(size_t new_capacity)
365
366
- if (new_capacity > m_capacity)
+ if (new_capacity > m_capacity * WORD_BITS)
367
368
- size_t new_word_count = num_words(new_capacity * WORD_BITS);
+ size_t new_word_count = num_words(new_capacity);
369
370
BitType *new_data = m_allocator.allocate(new_word_count);
371
std::copy(m_data, m_data + m_capacity, new_data);
0 commit comments