diff --git a/src/regex_impl.hh b/src/regex_impl.hh index 13c48c09..d73c7aa6 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -658,7 +658,11 @@ private: { if (m_current != m_next) return; - const auto new_capacity = m_capacity ? m_capacity * 2 : 4; + + constexpr int32_t initial_capacity = 64 / sizeof(Thread); + static_assert(initial_capacity >= 4); + + const auto new_capacity = m_capacity ? m_capacity * 2 : initial_capacity; const auto next_count = m_capacity - m_next; const auto new_next = new_capacity - next_count; Thread* new_data = new Thread[new_capacity];