diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h index 087f7ec2..ab50d5a7 100644 --- a/include/opendht/infohash.h +++ b/include/opendht/infohash.h @@ -250,8 +250,16 @@ public: return v; } - bool - operator<(const InfoHash& o) const { + bool operator==(const InfoHash& h) const { + auto a = reinterpret_cast(data()); + auto b = reinterpret_cast(h.data()); + for (size_t i=0; i<(size()/sizeof(uint32_t)); i++) + if (a[i] != b[i]) + return false; + return true; + } + + bool operator<(const InfoHash& o) const { for(unsigned i = 0; i < HASH_LEN; i++) { if((*this)[i] != o[i]) return (*this)[i] < o[i];