3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-21 11:52:07 +00:00

using pool<> in bitpattern.h

This commit is contained in:
Clifford Wolf 2014-12-30 23:45:43 +01:00
parent 1909edfa9c
commit 6fef4b82a2
3 changed files with 32 additions and 14 deletions

View file

@ -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++)