diff --git a/kernel/hashlib.h b/kernel/hashlib.h index f94945ec..3cc95b6e 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -63,18 +63,21 @@ struct hash_int_ops { static inline bool cmp(T a, T b) { return a == b; } +}; + +template<> struct hash_ops : hash_int_ops +{ static inline unsigned int hash(int32_t a) { return a; } +}; +template<> struct hash_ops : hash_int_ops +{ static inline unsigned int hash(int64_t a) { return mkhash(a, a >> 32); } }; -template<> struct hash_ops : hash_int_ops {}; -template<> struct hash_ops : hash_int_ops {}; -template<> struct hash_ops : hash_int_ops {}; - template<> struct hash_ops { static inline bool cmp(const std::string &a, const std::string &b) { return a == b; @@ -118,10 +121,9 @@ template struct hash_ops> { return a == b; } static inline unsigned int hash(std::vector a) { - hash_ops t_ops; unsigned int h = mkhash_init; for (auto k : a) - h = mkhash(h, t_ops.hash(k)); + h = mkhash(h, hash_ops::hash(k)); return h; } };