diff options
author | Mark Wielaard <mjw@redhat.com> | 2011-01-21 22:44:15 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2011-03-16 15:05:27 +0100 |
commit | 2fd892f1d51536513fda839653c61529b6bbe5be (patch) | |
tree | 8e87f58fb7ce26f70f52b25ca80a904dbf08d81f | |
parent | ea1437c20f3ff873b1ddb4457775749ea28d278a (diff) | |
download | elfutils-2fd892f1d51536513fda839653c61529b6bbe5be.tar.gz |
Add local hash for children_types.
-rw-r--r-- | libdw/c++/dwarf_output | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/libdw/c++/dwarf_output b/libdw/c++/dwarf_output index 03d89265..b6452917 100644 --- a/libdw/c++/dwarf_output +++ b/libdw/c++/dwarf_output @@ -246,12 +246,17 @@ namespace elfutils typedef std::vector<die_info_pair *> _base; size_t _m_hash; + size_t _m_local_hash; inline void set_hash () { _m_hash = 0; + _m_local_hash = 0; for (_base::iterator i = _base::begin (); i != _base::end (); ++i) - subr::hash_combine (_m_hash, (uintptr_t) *i); + { + subr::hash_combine (_m_hash, (uintptr_t) *i); + subr::hash_combine (_m_local_hash, (*i)->first.local_hash ()); + } } inline children_type () {} @@ -293,6 +298,7 @@ namespace elfutils inline bool is (const children_type &these) const { return (_m_hash == these._m_hash + && _m_local_hash == these._m_local_hash && size () == these.size () && std::equal (_base::begin (), _base::end (), these._base::begin ())); @@ -311,6 +317,11 @@ namespace elfutils { return const_iterator (_base::end (), subr::nothing ()); } + + inline size_t local_hash () const + { + return _m_local_hash; + } }; typedef children_type::iterator pointer; @@ -418,7 +429,7 @@ namespace elfutils { size_t hash = _m_tag; subr::hash_combine (hash, _m_attributes->local_hash ()); - subr::hash_combine (hash, _m_children->size ()); + subr::hash_combine (hash, _m_children->local_hash ()); return hash; } }; @@ -1499,7 +1510,15 @@ namespace elfutils attr_hash ^= (it->first << 3); } subr::hash_combine (hash, attr_hash); - subr::hash_combine (hash, _m_children.size ()); + + size_t children_hash = 0; + for (typename std::vector<entry *>::const_iterator it + = _m_children.begin (); + it != _m_children.end (); + ++it) + subr::hash_combine (children_hash, (*it)->local_hash ()); + subr::hash_combine (hash, children_hash); + return hash; } }; |