From dfd0740aa1fc2d02bf22e85a24d6f8a667f7b820 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Tue, 10 Mar 2026 22:43:34 +0300 Subject: [PATCH] Fix a -Wlogical-not-parentheses warning The function returns the number of lowest zero bits of a 32-bit value and shifts the value by that number. By the time it reaches last condition x can be zero if and only if the passed value was zero and hence we can immediately return 32. Initially the condition were likely supposed to be `if (!(x & 1))` but in this particular case it's the same as `!x` and subjectively it makes more sense to just check if the number is zero. See discussion in the #264. See-also: https://mirror.git.trinitydesktop.org/gitea/TDE/tqt/pulls/264 Signed-off-by: Alexander Golubev (cherry picked from commit 709a2722bd05f6e4ed8aa1106874a14892b937d2) --- src/tools/qlocale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qlocale.cpp b/src/tools/qlocale.cpp index d79872ef7..16735d53b 100644 --- a/src/tools/qlocale.cpp +++ b/src/tools/qlocale.cpp @@ -4430,7 +4430,7 @@ static int lo0bits(ULong *y) if (!(x & 1)) { k++; x >>= 1; - if (!x & 1) + if (!x) // At this point x is zero if and only if the *y was zero return 32; } *y = x;