From e57db5e9b256d801c1d4337e44e1a7173a115d07 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 20 Jul 2014 11:00:09 +0200 Subject: [PATCH] Added std::set to RTLIL::SigSpec conversion --- kernel/rtlil.cc | 13 ++++++++++--- kernel/rtlil.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index dea0e1050..748deae3e 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -1451,10 +1451,17 @@ RTLIL::SigSpec::SigSpec(RTLIL::SigBit bit, int width) RTLIL::SigSpec::SigSpec(std::vector bits) { - chunks.reserve(bits.size()); + this->width = 0; for (auto &bit : bits) - chunks.push_back(bit); - this->width = bits.size(); + append_bit(bit); + check(); +} + +RTLIL::SigSpec::SigSpec(std::set bits) +{ + this->width = 0; + for (auto &bit : bits) + append_bit(bit); check(); } diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 6290db21d..64136de04 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -505,6 +505,7 @@ struct RTLIL::SigSpec { SigSpec(RTLIL::State bit, int width = 1); SigSpec(RTLIL::SigBit bit, int width = 1); SigSpec(std::vector bits); + SigSpec(std::set bits); void expand(); void optimize(); RTLIL::SigSpec optimized() const; -- 2.30.2