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 /ecp5 | |
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 'ecp5')
-rw-r--r-- | ecp5/archdefs.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ecp5/archdefs.h b/ecp5/archdefs.h index 2b4590e5..57168af3 100644 --- a/ecp5/archdefs.h +++ b/ecp5/archdefs.h @@ -24,6 +24,7 @@ #include <boost/functional/hash.hpp> #include "base_clusterinfo.h" +#include "hashlib.h" #include "idstring.h" #include "nextpnr_namespaces.h" @@ -63,6 +64,7 @@ struct Location bool operator==(const Location &other) const { return x == other.x && y == other.y; } bool operator!=(const Location &other) const { return x != other.x || y != other.y; } bool operator<(const Location &other) const { return y == other.y ? x < other.x : y < other.y; } + unsigned int hash() const { return mkhash(x, y); } }; inline Location operator+(const Location &a, const Location &b) { return Location(a.x + b.x, a.y + b.y); } @@ -78,6 +80,7 @@ struct BelId { return location == other.location ? index < other.index : location < other.location; } + unsigned int hash() const { return mkhash(location.hash(), index); } }; struct WireId @@ -91,6 +94,7 @@ struct WireId { return location == other.location ? index < other.index : location < other.location; } + unsigned int hash() const { return mkhash(location.hash(), index); } }; struct PipId @@ -104,6 +108,7 @@ struct PipId { return location == other.location ? index < other.index : location < other.location; } + unsigned int hash() const { return mkhash(location.hash(), index); } }; typedef IdString BelBucketId; @@ -119,6 +124,7 @@ struct GroupId bool operator==(const GroupId &other) const { return (type == other.type) && (location == other.location); } bool operator!=(const GroupId &other) const { return (type != other.type) || (location != other.location); } + unsigned int hash() const { return mkhash(location.hash(), int(type)); } }; struct DecalId @@ -142,6 +148,7 @@ struct DecalId { return type != other.type || location != other.location || z != other.z || active != other.active; } + unsigned int hash() const { return mkhash(location.hash(), mkhash(z, int(type))); } }; struct ArchNetInfo |