From 021ba55b3811f7f12743e1dfe7c11c4aa523d3a6 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 14 Nov 2018 17:50:17 +1100 Subject: [PATCH] Small code tweak in DualThreadStack::swap_next --- src/regex_impl.hh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/regex_impl.hh b/src/regex_impl.hh index ca686a9c..79eef584 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -635,11 +635,10 @@ private: void swap_next() { kak_assert(m_next < m_capacity); - do - { - m_data[m_current++] = m_data[m_next++]; - } - while (m_next < m_capacity); + const int32_t count = m_capacity - m_next; + std::copy_n(m_data + m_next, count, m_data); + m_current = count; + m_next = m_capacity; } void grow_ifn()