diff options
author | David Shah <davey1576@gmail.com> | 2018-07-20 16:27:27 +0000 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-07-20 16:27:27 +0000 |
commit | 0d6f6f410d456b6dc456b5c1f919f3620926b6af (patch) | |
tree | a051a9eef682ab922c474850d235f301c2c708fd /common/nextpnr.h | |
parent | 6c835d76f27af79813299419780c039eb2a8b02e (diff) | |
parent | fd8239e170a7391d9c25d8681083507d9960abef (diff) | |
download | nextpnr-0d6f6f410d456b6dc456b5c1f919f3620926b6af.tar.gz nextpnr-0d6f6f410d456b6dc456b5c1f919f3620926b6af.tar.bz2 nextpnr-0d6f6f410d456b6dc456b5c1f919f3620926b6af.zip |
Merge branch 'gridapi' into 'master'
Gridapi
See merge request SymbioticEDA/nextpnr!11
Diffstat (limited to 'common/nextpnr.h')
-rw-r--r-- | common/nextpnr.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index bc64adb5..40fd3d13 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -27,6 +27,8 @@ #include <unordered_set> #include <vector> +#include <boost/functional/hash.hpp> + #ifndef NEXTPNR_H #define NEXTPNR_H @@ -158,8 +160,30 @@ struct GraphicElement std::string text; }; +struct Loc +{ + int x = -1, y = -1, z = -1; + + bool operator==(const Loc &other) const { return (x == other.x) && (y == other.y) && (z == other.z); } + bool operator!=(const Loc &other) const { return (x != other.x) || (y != other.y) || (z == other.z); } +}; + NEXTPNR_NAMESPACE_END +namespace std { +template <> struct hash<NEXTPNR_NAMESPACE_PREFIX Loc> +{ + std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX Loc &obj) const noexcept + { + std::size_t seed = 0; + boost::hash_combine(seed, hash<int>()(obj.x)); + boost::hash_combine(seed, hash<int>()(obj.y)); + boost::hash_combine(seed, hash<int>()(obj.z)); + return seed; + } +}; +} // namespace std + #include "archdefs.h" NEXTPNR_NAMESPACE_BEGIN |