3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-20 12:53:39 +00:00

hashlib: fixes from jix

This commit is contained in:
Emil J. Tywoniak 2024-11-20 12:11:37 +01:00
parent b9b9515bb0
commit ed70038aa1
2 changed files with 9 additions and 16 deletions

View file

@ -1067,10 +1067,11 @@ public:
DriveSpec &operator=(DriveBitMultiple const &bit) { return *this = DriveBit(bit); }
void updhash() const {
DriveSpec *that = (DriveSpec*)this;
if (hash_ != 0)
return;
pack();
that->hash_ = run_hash(chunks_);
that->hash_ |= (that->hash_ == 0);
hash_ = run_hash(chunks_);
hash_ |= (hash_ == 0);
}
Hasher hash_into(Hasher h) const;
@ -1372,9 +1373,7 @@ inline Hasher DriveChunk::hash_into(Hasher h) const
inline Hasher DriveSpec::hash_into(Hasher h) const
{
if (hash_ == 0)
updhash();
updhash();
h.eat(hash_);
return h;
}