summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglversionfunctions.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-08-08 10:42:57 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2014-08-09 09:06:29 +0200
commitd1ede822d8b76748a4f24e5a03fc12847b1119ba (patch)
treee9e394001f851c2c633775b4b7015c944048966b /src/gui/opengl/qopenglversionfunctions.h
parente41b45f1aedf1b3fe0ca4b22226ccc23bc71ab7c (diff)
QOpenGLVersionStatus: add constexpr
Also dropped two redundant qMakePair() calls. Change-Id: I7266ac9a3354ef4f60bf921fc0cd5d5a33c75b93 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/gui/opengl/qopenglversionfunctions.h')
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 304b944de8..d8307f183f 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -77,13 +77,13 @@ struct QOpenGLVersionStatus
InvalidStatus
};
- QOpenGLVersionStatus()
- : version(qMakePair(0, 0)),
+ Q_DECL_CONSTEXPR QOpenGLVersionStatus()
+ : version(0, 0),
status(InvalidStatus)
{}
- QOpenGLVersionStatus(int majorVersion, int minorVersion, QOpenGLVersionStatus::OpenGLStatus functionStatus)
- : version(qMakePair(majorVersion, minorVersion)),
+ Q_DECL_CONSTEXPR QOpenGLVersionStatus(int majorVersion, int minorVersion, QOpenGLVersionStatus::OpenGLStatus functionStatus)
+ : version(majorVersion, minorVersion),
status(functionStatus)
{}
@@ -91,20 +91,18 @@ struct QOpenGLVersionStatus
OpenGLStatus status;
};
-inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0)
+inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0) Q_DECL_NOTHROW
{
return qHash(static_cast<int>(v.status * 1000)
+ v.version.first * 100 + v.version.second * 10, seed);
}
-inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
+Q_DECL_CONSTEXPR inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
{
- if (lhs.status != rhs.status)
- return false;
- return lhs.version == rhs.version;
+ return lhs.status == rhs.status && lhs.version == rhs.version;
}
-inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
+Q_DECL_CONSTEXPR inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
{
return !operator==(lhs, rhs);
}