From 2b4490d8a7083dd835d74bb72d1535125415dba9 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 27 Jan 2020 03:49:49 +0800 Subject: [PATCH] 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. --- src/base/bittorrent/infohash.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base/bittorrent/infohash.cpp b/src/base/bittorrent/infohash.cpp index 122d4e88f..e050efbb8 100644 --- a/src/base/bittorrent/infohash.cpp +++ b/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) { +#if (LIBTORRENT_VERSION_NUM < 10200) return ::qHash(static_cast(key), seed); +#else + return ::qHash((std::hash {})(key), seed); +#endif }