mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-29 15:37:59 +00:00
driver: add --hash-seed
This commit is contained in:
parent
d071489ab1
commit
953508f6d2
5 changed files with 21 additions and 35 deletions
|
@ -81,13 +81,20 @@ class Hasher {
|
|||
// traditionally 5381 is used as starting value for the djb2 hash
|
||||
state = 5381;
|
||||
}
|
||||
static void set_fudge(uint32_t f) {
|
||||
fudge = f;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t state;
|
||||
static uint32_t fudge;
|
||||
// The XOR version of DJB2
|
||||
[[nodiscard]]
|
||||
static uint32_t mkhash(uint32_t a, uint32_t b) {
|
||||
return ((a << 5) + a) ^ b;
|
||||
uint32_t hash = ((a << 5) + a) ^ b;
|
||||
if (fudge)
|
||||
hash = fudge ^ mkhash_xorshift(hash);
|
||||
return hash;
|
||||
}
|
||||
public:
|
||||
void hash32(uint32_t i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue