mirror of https://github.com/YosysHQ/yosys.git
hashlib: fixes from jix
This commit is contained in:
parent
ed70038aa1
commit
026e9dae9d
|
@ -1112,7 +1112,6 @@ private:
|
|||
bool operator==(const DriveBitId &other) const { return id == other.id; }
|
||||
bool operator!=(const DriveBitId &other) const { return id != other.id; }
|
||||
bool operator<(const DriveBitId &other) const { return id < other.id; }
|
||||
// unsigned int hash() const { return id; }
|
||||
Hasher hash_into(Hasher h) const;
|
||||
};
|
||||
// Essentially a dict<DriveBitId, pool<DriveBitId>> but using less memory
|
||||
|
|
|
@ -264,7 +264,11 @@ struct hash_obj_ops {
|
|||
}
|
||||
template<typename T>
|
||||
static inline Hasher hash_into(const T *a, Hasher h) {
|
||||
return a ? a->hash_into(h) : h;
|
||||
if (a)
|
||||
a->hash_into(h);
|
||||
else
|
||||
h.eat(0);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
@ -785,13 +789,13 @@ public:
|
|||
}
|
||||
|
||||
Hasher hash_into(Hasher h) const {
|
||||
h.eat(entries.size());
|
||||
for (auto &it : entries) {
|
||||
Hasher entry_hash;
|
||||
entry_hash.eat(it.udata.first);
|
||||
entry_hash.eat(it.udata.second);
|
||||
h.commutative_eat(entry_hash.yield());
|
||||
}
|
||||
h.eat(entries.size());
|
||||
return h;
|
||||
}
|
||||
|
||||
|
@ -1155,10 +1159,10 @@ public:
|
|||
}
|
||||
|
||||
Hasher hash_into(Hasher h) const {
|
||||
h.eat(entries.size());
|
||||
for (auto &it : entries) {
|
||||
h.commutative_eat(ops.hash(it.udata).yield());
|
||||
}
|
||||
h.eat(entries.size());
|
||||
return h;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,6 @@ struct ModIndex : public RTLIL::Monitor
|
|||
{
|
||||
bool is_input, is_output;
|
||||
pool<PortInfo> ports;
|
||||
// SigBitInfo() : SigBitInfo{} {}
|
||||
// SigBitInfo& operator=(const SigBitInfo&) = default;
|
||||
|
||||
SigBitInfo() : is_input(false), is_output(false) { }
|
||||
|
||||
|
@ -310,7 +308,6 @@ struct ModWalker
|
|||
RTLIL::IdString port;
|
||||
int offset;
|
||||
PortBit(Cell* c, IdString p, int o) : cell(c), port(p), offset(o) {}
|
||||
// PortBit& operator=(const PortBit&) = default;
|
||||
|
||||
bool operator<(const PortBit &other) const {
|
||||
if (cell != other.cell)
|
||||
|
|
|
@ -408,8 +408,14 @@ namespace hashlib {
|
|||
};
|
||||
};
|
||||
|
||||
// TODO deprecate this
|
||||
/**
|
||||
* How to not use these methods:
|
||||
* 1. if(celltype.in({...})) -> if(celltype.in(...))
|
||||
* 2. pool<IdString> p; ... a.in(p) -> (bool)p.count(a)
|
||||
*/
|
||||
[[deprecated]]
|
||||
inline bool RTLIL::IdString::in(const pool<IdString> &rhs) const { return rhs.count(*this) != 0; }
|
||||
[[deprecated]]
|
||||
inline bool RTLIL::IdString::in(const pool<IdString> &&rhs) const { return rhs.count(*this) != 0; }
|
||||
|
||||
namespace RTLIL {
|
||||
|
@ -816,7 +822,7 @@ public:
|
|||
}
|
||||
|
||||
inline Hasher hash_into(Hasher h) const {
|
||||
// TODO hash size
|
||||
h.eat(size());
|
||||
for (auto b : *this)
|
||||
h.eat(b);
|
||||
return h;
|
||||
|
@ -1003,12 +1009,6 @@ public:
|
|||
SigSpec(const std::set<RTLIL::SigBit> &bits);
|
||||
explicit SigSpec(bool bit);
|
||||
|
||||
[[deprecated]]
|
||||
size_t get_hash() const {
|
||||
log_assert(false && "deprecated");
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline const std::vector<RTLIL::SigChunk> &chunks() const { pack(); return chunks_; }
|
||||
inline const std::vector<RTLIL::SigBit> &bits() const { inline_unpack(); return bits_; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue