diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-04-13 13:52:16 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-04-13 21:52:52 +0200 |
commit | f38d5e563fc6ecea9ac71003ec995d7df546193e (patch) | |
tree | c8e0adbdcca8a3bc2418da71756c8a4143a91c41 /src | |
parent | 466a4245142d490890d11580c956d9288fab3ad3 (diff) |
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qmath.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index 5fe635877e..391d6d4282 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) { |