diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 5cb372de..bc0ff25a 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -158,16 +158,16 @@ namespace etl value_type key_value_pair; }; - //friend bool operator ==(const node_t& lhs, const node_t& rhs) - //{ - // return (lhs.key_value_pair.first == rhs.key_value_pair.first) && - // (lhs.key_value_pair.second == rhs.key_value_pair.second); - //} + friend bool operator ==(const node_t& lhs, const node_t& rhs) + { + return (lhs.key_value_pair.first == rhs.key_value_pair.first) && + (lhs.key_value_pair.second == rhs.key_value_pair.second); + } - //friend bool operator !=(const node_t& lhs, const node_t& rhs) - //{ - // return !(lhs == rhs); - //} + friend bool operator !=(const node_t& lhs, const node_t& rhs) + { + return !(lhs == rhs); + } protected: @@ -1512,23 +1512,21 @@ namespace etl template bool operator ==(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) { - return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); + const bool sizes_match = (lhs.size() == rhs.size()); + bool elements_match = true; - //const bool sizes_match = (lhs.size() == rhs.size()); - //bool elements_match = true; + if (sizes_match) + { + for (size_t i = 0; (i < lhs.bucket_count()) && elements_match; ++i) + { + if (!etl::is_permutation(lhs.begin(i), lhs.end(i), rhs.begin(i))) + { + elements_match = false; + } + } + } - //if (sizes_match) - //{ - // for (size_t i = 0; (i < lhs.bucket_count()) && elements_match; ++i) - // { - // if (!etl::is_permutation(lhs.begin(i), lhs.end(i), rhs.begin(i))) - // { - // elements_match = false; - // } - // } - //} - - //return (sizes_match && elements_match); + return (sizes_match && elements_match); } //*************************************************************************** diff --git a/test/test_murmur3.cpp b/test/test_murmur3.cpp index f205a349..e5217d5a 100644 --- a/test/test_murmur3.cpp +++ b/test/test_murmur3.cpp @@ -50,7 +50,7 @@ namespace char* begin = (char*)&storage[0]; strcpy(begin, data.c_str()); - uint32_t hash = etl::murmur3(begin, begin + 10); + uint32_t hash = etl::murmur3(begin, begin + data.size()); uint32_t compare; MurmurHash3_x86_32(begin, data.size(), 0, &compare);