Browse Source

Use faster hash function

qHash(QString) will need to hash/loop through all the data while the new
code will only need one memcpy() and a few bit manipulations.
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
2b4490d8a7
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/bittorrent/infohash.cpp

4
src/base/bittorrent/infohash.cpp

@ -89,5 +89,9 @@ bool BitTorrent::operator!=(const InfoHash &left, const InfoHash &right)
uint BitTorrent::qHash(const InfoHash &key, const uint seed) uint BitTorrent::qHash(const InfoHash &key, const uint seed)
{ {
#if (LIBTORRENT_VERSION_NUM < 10200)
return ::qHash(static_cast<QString>(key), seed); return ::qHash(static_cast<QString>(key), seed);
#else
return ::qHash((std::hash<lt::sha1_hash> {})(key), seed);
#endif
} }

Loading…
Cancel
Save