mirror of
https://github.com/YosysHQ/yosys.git
synced 2026-08-22 06:07:26 +02:00
using pool<> in bitpattern.h
This commit is contained in:
+15
-1
@@ -62,7 +62,8 @@ template<> struct hash_ops<int> {
|
||||
bool cmp(T a, T b) const {
|
||||
return a == b;
|
||||
}
|
||||
unsigned int hash(unsigned int a) const {
|
||||
template<typename T>
|
||||
unsigned int hash(T a) const {
|
||||
return a;
|
||||
}
|
||||
};
|
||||
@@ -90,6 +91,19 @@ template<typename P, typename Q> struct hash_ops<std::pair<P, Q>> {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct hash_ops<std::vector<T>> {
|
||||
bool cmp(std::vector<T> a, std::vector<T> b) const {
|
||||
return a == b;
|
||||
}
|
||||
unsigned int hash(std::vector<T> a) const {
|
||||
hash_ops<T> t_ops;
|
||||
unsigned int h = mkhash_init;
|
||||
for (auto k : a)
|
||||
h = mkhash(h, t_ops.hash(k));
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
struct hash_cstr_ops {
|
||||
bool cmp(const char *a, const char *b) const {
|
||||
for (int i = 0; a[i] || b[i]; i++)
|
||||
|
||||
Reference in New Issue
Block a user