mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 18:56:08 +03:00
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.
This commit is contained in:
parent
ab6079e0d5
commit
43fe5214d2
1 changed files with 4 additions and 0 deletions
|
@ -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…
Reference in a new issue