diff --git a/kernel/drivertools.h b/kernel/drivertools.h index e584f4d39..23eba9f1c 100644 --- a/kernel/drivertools.h +++ b/kernel/drivertools.h @@ -1112,7 +1112,6 @@ private: bool operator==(const DriveBitId &other) const { return id == other.id; } bool operator!=(const DriveBitId &other) const { return id != other.id; } bool operator<(const DriveBitId &other) const { return id < other.id; } - // unsigned int hash() const { return id; } Hasher hash_into(Hasher h) const; }; // Essentially a dict> but using less memory diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 0e712a2a3..6927702e1 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -264,7 +264,11 @@ struct hash_obj_ops { } template static inline Hasher hash_into(const T *a, Hasher h) { - return a ? a->hash_into(h) : h; + if (a) + a->hash_into(h); + else + h.eat(0); + return h; } }; /** @@ -785,13 +789,13 @@ public: } Hasher hash_into(Hasher h) const { - h.eat(entries.size()); for (auto &it : entries) { Hasher entry_hash; entry_hash.eat(it.udata.first); entry_hash.eat(it.udata.second); h.commutative_eat(entry_hash.yield()); } + h.eat(entries.size()); return h; } @@ -1155,10 +1159,10 @@ public: } Hasher hash_into(Hasher h) const { - h.eat(entries.size()); for (auto &it : entries) { h.commutative_eat(ops.hash(it.udata).yield()); } + h.eat(entries.size()); return h; } diff --git a/kernel/modtools.h b/kernel/modtools.h index 0ed858e37..921df304c 100644 --- a/kernel/modtools.h +++ b/kernel/modtools.h @@ -60,8 +60,6 @@ struct ModIndex : public RTLIL::Monitor { bool is_input, is_output; pool ports; - // SigBitInfo() : SigBitInfo{} {} - // SigBitInfo& operator=(const SigBitInfo&) = default; SigBitInfo() : is_input(false), is_output(false) { } @@ -310,7 +308,6 @@ struct ModWalker RTLIL::IdString port; int offset; PortBit(Cell* c, IdString p, int o) : cell(c), port(p), offset(o) {} - // PortBit& operator=(const PortBit&) = default; bool operator<(const PortBit &other) const { if (cell != other.cell) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 0f4bec7b0..330af649f 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -408,8 +408,14 @@ namespace hashlib { }; }; -// TODO deprecate this +/** + * How to not use these methods: + * 1. if(celltype.in({...})) -> if(celltype.in(...)) + * 2. pool p; ... a.in(p) -> (bool)p.count(a) + */ +[[deprecated]] inline bool RTLIL::IdString::in(const pool &rhs) const { return rhs.count(*this) != 0; } +[[deprecated]] inline bool RTLIL::IdString::in(const pool &&rhs) const { return rhs.count(*this) != 0; } namespace RTLIL { @@ -816,7 +822,7 @@ public: } inline Hasher hash_into(Hasher h) const { - // TODO hash size + h.eat(size()); for (auto b : *this) h.eat(b); return h; @@ -1003,12 +1009,6 @@ public: SigSpec(const std::set &bits); explicit SigSpec(bool bit); - [[deprecated]] - size_t get_hash() const { - log_assert(false && "deprecated"); - return 0; - } - inline const std::vector &chunks() const { pack(); return chunks_; } inline const std::vector &bits() const { inline_unpack(); return bits_; }