From: Clifford Wolf Date: Wed, 12 Aug 2015 11:37:09 +0000 (+0200) Subject: Fixed hashlib for 64 bit int keys X-Git-Tag: yosys-0.6~198^2~4 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc468cb6f2846919d84e7586c5551c94d3234f6d;p=yosys.git Fixed hashlib for 64 bit int keys --- diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 2f8479502..f94945eca 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -58,17 +58,23 @@ template struct hash_ops { } }; -template<> struct hash_ops { +struct hash_int_ops { template static inline bool cmp(T a, T b) { return a == b; } - template - 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 : 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;