mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 13:18:56 +00:00
Merge pull request #1862 from boqwxp/cleanup_techmap
Clean up `passes/techmap/techmap.cc`
This commit is contained in:
commit
ff785cdb46
5 changed files with 169 additions and 153 deletions
|
@ -171,6 +171,7 @@ X(techmap_autopurge)
|
|||
X(_TECHMAP_BITS_CONNMAP_)
|
||||
X(_TECHMAP_CELLTYPE_)
|
||||
X(techmap_celltype)
|
||||
X(_TECHMAP_FAIL_)
|
||||
X(techmap_maccmap)
|
||||
X(_TECHMAP_REPLACE_)
|
||||
X(techmap_simplemap)
|
||||
|
|
|
@ -207,6 +207,7 @@ class dict
|
|||
entry_t() { }
|
||||
entry_t(const std::pair<K, T> &udata, int next) : udata(udata), next(next) { }
|
||||
entry_t(std::pair<K, T> &&udata, int next) : udata(std::move(udata)), next(next) { }
|
||||
bool operator<(const entry_t &other) const { return udata.first < other.udata.first; }
|
||||
};
|
||||
|
||||
std::vector<int> hashtable;
|
||||
|
@ -615,6 +616,15 @@ public:
|
|||
return !operator==(other);
|
||||
}
|
||||
|
||||
unsigned int hash() const {
|
||||
unsigned int h = mkhash_init;
|
||||
for (auto &entry : entries) {
|
||||
h ^= hash_ops<K>::hash(entry.udata.first);
|
||||
h ^= hash_ops<T>::hash(entry.udata.second);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
void reserve(size_t n) { entries.reserve(n); }
|
||||
size_t size() const { return entries.size(); }
|
||||
bool empty() const { return entries.empty(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue