Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Adam <dev@robert-adam.de>2021-11-10 21:30:56 +0300
committerRobert Adam <dev@robert-adam.de>2022-03-22 20:28:26 +0300
commit03a4c6706fd215afcb9c1216a50b473e543003ee (patch)
tree40ebda03aff76181b8954b0c5065a7caa8f0beba /src/Version.h
parent7cba382841cb59e555c1f821a38c4d326ba9e220 (diff)
REFAC: Make raw-version functions constexpr
The manipulation of raw version specifiers was turned into constexpr functions, in order for them to be usable in constexpr expressions.
Diffstat (limited to 'src/Version.h')
-rw-r--r--src/Version.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Version.h b/src/Version.h
index 0e0d4add7..cced5fe27 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -27,8 +27,15 @@ unsigned int getRaw(const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSIO
QString toString(mumble_raw_version_t version);
bool get(int *major, int *minor, int *patch, const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSION)));
-unsigned int toRaw(int major, int minor, int patch);
-void fromRaw(unsigned int version, int *major, int *minor, int *patch);
+constexpr Version::mumble_raw_version_t toRaw(int major, int minor, int patch) {
+ return (major << 16) | (minor << 8) | patch;
+}
+
+constexpr void fromRaw(unsigned int version, int *major, int *minor, int *patch) {
+ *major = (version & 0xFFFF0000) >> 16;
+ *minor = (version & 0xFF00) >> 8;
+ *patch = (version & 0xFF);
+}
}; // namespace Version