aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/hashmap.h
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-12-27 12:02:57 +0100
committerClifford Wolf <clifford@clifford.at>2014-12-27 12:02:57 +0100
commit6c8b0a5fd138d19b47191400f020c2472944f826 (patch)
treee67f6b311e40f7b848457e749b6b3e214bf2fa8d /kernel/hashmap.h
parent2c2f8e6e9f4eadbb191df8a8dbeee95443fc9f08 (diff)
downloadyosys-6c8b0a5fd138d19b47191400f020c2472944f826.tar.gz
yosys-6c8b0a5fd138d19b47191400f020c2472944f826.tar.bz2
yosys-6c8b0a5fd138d19b47191400f020c2472944f826.zip
More dict/pool related changes
Diffstat (limited to 'kernel/hashmap.h')
-rw-r--r--kernel/hashmap.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/hashmap.h b/kernel/hashmap.h
index 729b4916c..431e8122e 100644
--- a/kernel/hashmap.h
+++ b/kernel/hashmap.h
@@ -25,10 +25,18 @@
#define YOSYS_HASHTABLE_SIZE_FACTOR 3
+// The XOR version of DJB2
+// (traditionally 5381 is used as starting value for the djb2 hash)
inline unsigned int mkhash(unsigned int a, unsigned int b) {
return ((a << 5) + a) ^ b;
}
+// The ADD version of DJB2
+// (use this version as last call for cache locality in b)
+inline unsigned int mkhash_add(unsigned int a, unsigned int b) {
+ return ((a << 5) + a) + b;
+}
+
template<typename T> struct hash_ops {
bool cmp(const T &a, const T &b) const {
return a == b;