From 60e83b24f9a3865c4ccb55d8f13c3c4e20464c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 11 May 2023 21:31:10 +0200 Subject: [PATCH] Use as much as possible of the 64b hash in Qt6 --- src/common/hash.h | 10 +++++----- src/map/IMG/rgnfile.cpp | 7 +++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/common/hash.h b/src/common/hash.h index 5a31ebeb..2e62af9d 100644 --- a/src/common/hash.h +++ b/src/common/hash.h @@ -6,13 +6,13 @@ #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #define HASH_T uint + +inline uint qHash(const QPoint &p) +{ + return qHash(QPair(p.x(), p.y())); +} #else // QT6 #define HASH_T size_t #endif // QT6 -inline HASH_T qHash(const QPoint &p) -{ - return ::qHash(p.x()) ^ ::qHash(p.y()); -} - #endif // HASH_H diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index c8dc949a..39f60d53 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -1,5 +1,6 @@ #include "common/rectc.h" #include "common/garmin.h" +#include "common/hash.h" #include "deltastream.h" #include "huffmanstream.h" #include "style.h" @@ -15,10 +16,8 @@ using namespace IMG; static quint64 pointId(const QPoint &pos, quint32 type) { - quint64 id; - - uint hash = (uint)qHash(QPair(pos.x(), pos.y())); - id = ((quint64)type)<<32 | hash; + quint64 hash = qHash(pos); + quint64 id = ((quint64)type)<<40 | (hash & 0xFFFFFFFFFF); // Increase rendering priorities for some special items if (!Style::isCountry(type) && !Style::isMarina(type))