summaryrefslogtreecommitdiff
path: root/kernel/hashlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/hashlib.h')
-rw-r--r--kernel/hashlib.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/hashlib.h b/kernel/hashlib.h
index 3c824b8c..df534ec1 100644
--- a/kernel/hashlib.h
+++ b/kernel/hashlib.h
@@ -147,7 +147,7 @@ struct hash_ptr_ops {
return a == b;
}
static inline unsigned int hash(const void *a) {
- return (unsigned long)a;
+ return (uintptr_t)a;
}
};
@@ -868,6 +868,13 @@ public:
return !operator==(other);
}
+ bool hash() const {
+ unsigned int hashval = mkhash_init;
+ for (auto &it : entries)
+ hashval ^= ops.hash(it.udata);
+ return hashval;
+ }
+
void reserve(size_t n) { entries.reserve(n); }
size_t size() const { return entries.size(); }
bool empty() const { return entries.empty(); }