From f38d5e563fc6ecea9ac71003ec995d7df546193e Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 13 Apr 2020 13:52:16 +0200 Subject: [PATCH] Fix qConstexprNextPowerOfTwo(qint64) to return quint64 It doesn't make sense to lose precision, and that's a fatal warning when used on a 32-bit platform: implicit conversion loses integer precision: 'quint64' (aka 'unsigned long long') to 'quint32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32] Also fix coding style. Amends 7ef382649754c261ca9eb99dd50b67050e748efb Change-Id: I2c8f51883d74f0c6dc1b5faefe7b3ace1d9c15b9 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qmath.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index 5fe635877ed..391d6d42827 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -265,14 +265,16 @@ constexpr inline quint64 qConstexprNextPowerOfTwo(quint64 v) { return v; } -constexpr inline quint32 qConstexprNextPowerOfTwo(qint32 v) { +constexpr inline quint32 qConstexprNextPowerOfTwo(qint32 v) +{ return qConstexprNextPowerOfTwo(quint32(v)); } -constexpr inline quint32 qConstexprNextPowerOfTwo(qint64 v) { +constexpr inline quint64 qConstexprNextPowerOfTwo(qint64 v) +{ return qConstexprNextPowerOfTwo(quint64(v)); } -} +} // namespace QtPrivate constexpr inline quint32 qNextPowerOfTwo(quint32 v) {