diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-08-13 09:52:06 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-08-13 09:52:06 +0200 |
commit | 80910d13a610886f4430fbd991ada78b2e586ada (patch) | |
tree | c582d1b1394600030c8bd88a8ec4a3b25178fa1f /kernel/hashlib.h | |
parent | c699d7c6145f978b1864c2be25d9f0607099a3e5 (diff) | |
parent | 698357dd9a17365566f4db2662e9ce9fea7594c4 (diff) | |
download | yosys-80910d13a610886f4430fbd991ada78b2e586ada.tar.gz yosys-80910d13a610886f4430fbd991ada78b2e586ada.tar.bz2 yosys-80910d13a610886f4430fbd991ada78b2e586ada.zip |
Merge branch 'master' of github.com:cliffordwolf/yosys
Diffstat (limited to 'kernel/hashlib.h')
-rw-r--r-- | kernel/hashlib.h | 12 |
1 files changed, 9 insertions, 3 deletions
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<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; |