Skip to content

Commit

Permalink
add a qHash for QUuid
Browse files Browse the repository at this point in the history
upstream commits:
qt/qtbase@55d68a1

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
  • Loading branch information
fluxer committed May 31, 2016
1 parent 55313de commit 731802d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/plugin/quuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,4 +918,15 @@ QUuid QUuid::createUuid()
guid; otherwise returns false.
*/

/**
Returns a hash of the QUuid
*/
uint qHash(const QUuid &uuid)
{
return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])
^ ((uuid.data4[4] << 24) | (uuid.data4[5] << 16) | (uuid.data4[6] << 8) | uuid.data4[7]);
}


QT_END_NAMESPACE
2 changes: 2 additions & 0 deletions src/core/plugin/quuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &);
#endif

Q_CORE_EXPORT uint qHash(const QUuid &uuid);

QT_END_NAMESPACE

QT_END_HEADER
Expand Down

0 comments on commit 731802d

Please sign in to comment.