linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07063
[Bug 1193899] Re: Incorrect hasher for class CID.
>>if you can find evidence that this change does reduce collisions, please provide it; for now, this is nonsense to me.
ok.
>>unrelated point: the change from CID to CID* as key in hashed containers in rev 14282 seems very strange, especially the custom hasher (the STL should already know how to hash pointers...).
Moving from CID to CID * in this case is not important, it is only used as a diagnostic. Saving resources has simply not been tested, because in this way the code is crashing. Please do not pay for a given change any attention.
--
You received this bug notification because you are a member of
Dcplusplus-team, which is subscribed to DC++.
https://bugs.launchpad.net/bugs/1193899
Title:
Incorrect hasher for class CID.
Status in DC++:
Incomplete
Bug description:
Please replace the incorrect class hasher CID, on hasher, taking into
account all the data, and as a consequence. eliminating collisions.
This change will increase the efficiency of search hashing.
#include <boost/functional/hash.hpp>
class CID
{
...
size_t toHash() const
{
return boost::hash<uint8_t[SIZE]>()(cid);
}
...
};
namespace std
{
template<>
struct hash<CID>
{
size_t operator()(const CID& rhs) const
{
return rhs.toHash();
}
};
template<>
struct hash<CID*>
{
size_t operator()(const CID* rhs) const
{
return rhs->toHash();
}
};
...
}
Original commit from FlylinkDC++:
https://code.google.com/p/flylinkdc/source/detail?r=14282 and
https://code.google.com/p/flylinkdc/source/detail?r=14283
To manage notifications about this bug go to:
https://bugs.launchpad.net/dcplusplus/+bug/1193899/+subscriptions
References