mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-15 13:28:59 +00:00
Fixed hashlib for 64 bit int keys
This commit is contained in:
parent
f81bf9bdea
commit
bc468cb6f2
|
@ -58,17 +58,23 @@ template<typename T> struct hash_ops {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct hash_ops<int> {
|
struct hash_int_ops {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static inline bool cmp(T a, T b) {
|
static inline bool cmp(T a, T b) {
|
||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
template<typename T>
|
static inline unsigned int hash(int32_t a) {
|
||||||
static inline unsigned int hash(T a) {
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
static inline unsigned int hash(int64_t a) {
|
||||||
|
return mkhash(a, a >> 32);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<> struct hash_ops<int> : hash_int_ops {};
|
||||||
|
template<> struct hash_ops<long> : hash_int_ops {};
|
||||||
|
template<> struct hash_ops<long long> : hash_int_ops {};
|
||||||
|
|
||||||
template<> struct hash_ops<std::string> {
|
template<> struct hash_ops<std::string> {
|
||||||
static inline bool cmp(const std::string &a, const std::string &b) {
|
static inline bool cmp(const std::string &a, const std::string &b) {
|
||||||
return a == b;
|
return a == b;
|
||||||
|
|
Loading…
Reference in a new issue