diff options
author | gatecat <gatecat@ds0.me> | 2021-06-01 16:12:57 +0100 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-06-02 14:27:56 +0100 |
commit | ff72454f8391ab4785fa8314f3efbbea96c30422 (patch) | |
tree | ec1606d83a643de5fab75998ecf086229376f92d /common/idstringlist.h | |
parent | 76ef7688643ae777f670b2bb2fbab2ddbeed9196 (diff) | |
download | nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.tar.gz nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.tar.bz2 nextpnr-ff72454f8391ab4785fa8314f3efbbea96c30422.zip |
Add hash() member functions
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'common/idstringlist.h')
-rw-r--r-- | common/idstringlist.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/idstringlist.h b/common/idstringlist.h index 24a46731..753b408c 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,6 +68,14 @@ struct IdStringList static IdStringList concat(IdStringList a, IdStringList b); IdStringList slice(size_t s, size_t e) const; + + unsigned int hash() const + { + unsigned int h = mkhash_init; + for (const auto &val : ids) + h = mkhash(h, val.hash()); + return h; + } }; NEXTPNR_NAMESPACE_END |