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>
This commit is contained in:
Shawn Rutledge 2020-04-13 13:52:16 +02:00
parent 466a424514
commit f38d5e563f

View File

@ -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)
{