From 5cf6223bf310fdf676e190eab0f2f75e6598f356 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 22 Jul 2024 17:45:17 +0200 Subject: [PATCH] sigspec: swap disposable for benchmark --- kernel/rtlil.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index d3946a620..6f1cda3b0 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -4034,12 +4034,14 @@ void RTLIL::SigSpec::unpack() const cover("kernel.rtlil.sigspec.convert.unpack"); log_assert(that->bits_.empty()); + std::vector disposable; + that->bits_.reserve(that->width_); for (auto &c : that->chunks_) for (int i = 0; i < c.width; i++) that->bits_.emplace_back(c, i); - that->chunks_.clear(); + that->chunks_.swap(disposable); that->hash_ = 0; }