diff options
author | gatecat <gatecat@ds0.me> | 2021-06-03 09:04:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 09:04:34 +0100 |
commit | a3d8b4f9d198226ec0903e34a8d290b376b45c0b (patch) | |
tree | ada2c6a5d48e766fa523e633aaa28179baea3273 /common/idstringlist.h | |
parent | 589ca8ded5da2012e4388a3ec4c8fae74dff75e4 (diff) | |
parent | dcbb322447a7fb59cabe197ec1dd2307acfa3681 (diff) | |
download | nextpnr-a3d8b4f9d198226ec0903e34a8d290b376b45c0b.tar.gz nextpnr-a3d8b4f9d198226ec0903e34a8d290b376b45c0b.tar.bz2 nextpnr-a3d8b4f9d198226ec0903e34a8d290b376b45c0b.zip |
Merge pull request #718 from YosysHQ/gatecat/hashlib
Moving from unordered_{map, set} to hashlib
Diffstat (limited to 'common/idstringlist.h')
-rw-r--r-- | common/idstringlist.h | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/common/idstringlist.h b/common/idstringlist.h index 24a46731..f101ecca 100644 --- a/common/idstringlist.h +++ b/common/idstringlist.h @@ -22,6 +22,7 @@ #define IDSTRING_LIST_H #include <boost/functional/hash.hpp> +#include "hashlib.h" #include "idstring.h" #include "nextpnr_namespaces.h" #include "sso_array.h" @@ -67,22 +68,16 @@ struct IdStringList static IdStringList concat(IdStringList a, IdStringList b); IdStringList slice(size_t s, size_t e) const; -}; - -NEXTPNR_NAMESPACE_END -namespace std { -template <> struct hash<NEXTPNR_NAMESPACE_PREFIX IdStringList> -{ - std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX IdStringList &obj) const noexcept + unsigned int hash() const { - std::size_t seed = 0; - boost::hash_combine(seed, hash<size_t>()(obj.size())); - for (auto &id : obj) - boost::hash_combine(seed, hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(id)); - return seed; + unsigned int h = mkhash_init; + for (const auto &val : ids) + h = mkhash(h, val.hash()); + return h; } }; -} // namespace std + +NEXTPNR_NAMESPACE_END #endif /* IDSTRING_LIST_H */ |