1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 17:15:14 +01:00

Use as much as possible of the 64b hash in Qt6

This commit is contained in:
Martin Tůma 2023-05-11 21:31:10 +02:00
parent 9b3c11cc68
commit 60e83b24f9
2 changed files with 8 additions and 9 deletions

View File

@ -6,13 +6,13 @@
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#define HASH_T uint #define HASH_T uint
inline uint qHash(const QPoint &p)
{
return qHash(QPair<int, int>(p.x(), p.y()));
}
#else // QT6 #else // QT6
#define HASH_T size_t #define HASH_T size_t
#endif // QT6 #endif // QT6
inline HASH_T qHash(const QPoint &p)
{
return ::qHash(p.x()) ^ ::qHash(p.y());
}
#endif // HASH_H #endif // HASH_H

View File

@ -1,5 +1,6 @@
#include "common/rectc.h" #include "common/rectc.h"
#include "common/garmin.h" #include "common/garmin.h"
#include "common/hash.h"
#include "deltastream.h" #include "deltastream.h"
#include "huffmanstream.h" #include "huffmanstream.h"
#include "style.h" #include "style.h"
@ -15,10 +16,8 @@ using namespace IMG;
static quint64 pointId(const QPoint &pos, quint32 type) static quint64 pointId(const QPoint &pos, quint32 type)
{ {
quint64 id; quint64 hash = qHash(pos);
quint64 id = ((quint64)type)<<40 | (hash & 0xFFFFFFFFFF);
uint hash = (uint)qHash(QPair<int, int>(pos.x(), pos.y()));
id = ((quint64)type)<<32 | hash;
// Increase rendering priorities for some special items // Increase rendering priorities for some special items
if (!Style::isCountry(type) && !Style::isMarina(type)) if (!Style::isCountry(type) && !Style::isMarina(type))