Matthew Poremba has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/29652 )
Change subject: mem-ruby: Allow MachineID to be unordered key
......................................................................
mem-ruby: Allow MachineID to be unordered key
Define an std::hash function so that MachineID may be used as a key
type for unordered STL containers.
Change-Id: Ibc3bc78149c69683207d8967542fa6e8d545f75c
---
M src/mem/ruby/common/MachineID.hh
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/mem/ruby/common/MachineID.hh
b/src/mem/ruby/common/MachineID.hh
index 64082d7..3ef7b88 100644
--- a/src/mem/ruby/common/MachineID.hh
+++ b/src/mem/ruby/common/MachineID.hh
@@ -67,6 +67,16 @@
return (obj1.type != obj2.type || obj1.num != obj2.num);
}
+namespace std {
+ template<>
+ struct hash<MachineID> {
+ inline size_t operator()(const MachineID& id) const {
+ size_t hval = MachineType_base_level(id.type) << 16 | id.num;
+ return hval;
+ }
+ };
+}
+
// Output operator declaration
std::ostream& operator<<(std::ostream& out, const MachineID& obj);
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/29652
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ibc3bc78149c69683207d8967542fa6e8d545f75c
Gerrit-Change-Number: 29652
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s