3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

hashlib: merge hash_ops with hash_top_ops for plugin compat

This commit is contained in:
Emil J. Tywoniak 2025-01-13 20:21:05 +01:00
parent 85c425469c
commit 901935fbce
2 changed files with 44 additions and 28 deletions

View file

@ -398,13 +398,16 @@ struct RTLIL::IdString
namespace hashlib {
template <>
struct hash_top_ops<RTLIL::IdString> {
struct hash_ops<RTLIL::IdString> {
static inline bool cmp(const RTLIL::IdString &a, const RTLIL::IdString &b) {
return a == b;
}
static inline Hasher hash(const RTLIL::IdString id) {
[[nodiscard]] static inline Hasher hash(const RTLIL::IdString id) {
return id.hash_top();
}
[[nodiscard]] static inline Hasher hash_into(const RTLIL::IdString id, Hasher h) {
return id.hash_into(h);
}
};
};
@ -920,13 +923,16 @@ struct RTLIL::SigBit
namespace hashlib {
template <>
struct hash_top_ops<RTLIL::SigBit> {
struct hash_ops<RTLIL::SigBit> {
static inline bool cmp(const RTLIL::SigBit &a, const RTLIL::SigBit &b) {
return a == b;
}
static inline Hasher hash(const RTLIL::SigBit sb) {
[[nodiscard]] static inline Hasher hash(const RTLIL::SigBit sb) {
return sb.hash_top();
}
[[nodiscard]] static inline Hasher hash_into(const RTLIL::SigBit sb, Hasher h) {
return sb.hash_into(h);
}
};
};