summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qalgorithms.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-01-12 09:58:00 -0800
committerThiago Macieira <thiago.macieira@intel.com>2022-01-12 16:36:54 -0800
commit214df31916c53e46348173fc02fe53f2b9db729a (patch)
treebaa24cdadce46c96435290dc6f982886de9954e8 /src/corelib/tools/qalgorithms.h
parented753eb5fbd29f323077ac7475fde66ec6a0a12f (diff)
Add a few explicit conversions back from int
Suppresses GCC's -Wconversion, which is not enabled by default. error: conversion from ‘int’ to ‘quint8’ {aka ‘unsigned char’} may change value [-Werror=conversion] Change-Id: I0e5f6bec596a4a78bd3bfffd16c998102bd51f7c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/tools/qalgorithms.h')
-rw-r--r--src/corelib/tools/qalgorithms.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 11e4d9da39..a72215e8d6 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -333,7 +333,7 @@ constexpr inline uint qConstexprCountTrailingZeroBits(quint64 v) noexcept
constexpr inline uint qConstexprCountTrailingZeroBits(quint8 v) noexcept
{
unsigned int c = 8; // c will be the number of zero bits on the right
- v &= -signed(v);
+ v &= quint8(-signed(v));
if (v) c--;
if (v & 0x0000000F) c -= 4;
if (v & 0x00000033) c -= 2;
@@ -344,7 +344,7 @@ constexpr inline uint qConstexprCountTrailingZeroBits(quint8 v) noexcept
constexpr inline uint qConstexprCountTrailingZeroBits(quint16 v) noexcept
{
unsigned int c = 16; // c will be the number of zero bits on the right
- v &= -signed(v);
+ v &= quint16(-signed(v));
if (v) c--;
if (v & 0x000000FF) c -= 8;
if (v & 0x00000F0F) c -= 4;