aboutsummaryrefslogtreecommitdiffstats
path: root/common/idstringlist.h
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-06-03 09:04:34 +0100
committerGitHub <noreply@github.com>2021-06-03 09:04:34 +0100
commita3d8b4f9d198226ec0903e34a8d290b376b45c0b (patch)
treeada2c6a5d48e766fa523e633aaa28179baea3273 /common/idstringlist.h
parent589ca8ded5da2012e4388a3ec4c8fae74dff75e4 (diff)
parentdcbb322447a7fb59cabe197ec1dd2307acfa3681 (diff)
downloadnextpnr-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.h21
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 */