summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-08-12 13:37:09 +0200
committerClifford Wolf <clifford@clifford.at>2015-08-12 13:37:09 +0200
commitbc468cb6f2846919d84e7586c5551c94d3234f6d (patch)
treeff070495ebf02f7c5cac518f25435b7560272bb8
parentf81bf9bdea7f99602bc2c7f0d43f1058a716508e (diff)
Fixed hashlib for 64 bit int keys
-rw-r--r--kernel/hashlib.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/hashlib.h b/kernel/hashlib.h
index 2f847950..f94945ec 100644
--- a/kernel/hashlib.h
+++ b/kernel/hashlib.h
@@ -58,17 +58,23 @@ template<typename T> struct hash_ops {
}
};
-template<> struct hash_ops<int> {
+struct hash_int_ops {
template<typename T>
static inline bool cmp(T a, T b) {
return a == b;
}
- template<typename T>
- static inline unsigned int hash(T a) {
+ static inline unsigned int hash(int32_t a) {
return a;
}
+ static inline unsigned int hash(int64_t a) {
+ return mkhash(a, a >> 32);
+ }
};
+template<> struct hash_ops<int> : hash_int_ops {};
+template<> struct hash_ops<long> : hash_int_ops {};
+template<> struct hash_ops<long long> : hash_int_ops {};
+
template<> struct hash_ops<std::string> {
static inline bool cmp(const std::string &a, const std::string &b) {
return a == b;