summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2026-03-10 22:43:34 +0300
committerAlexander Golubev <fatzer2@gmail.com>2026-03-10 22:43:34 +0300
commitbcd884acb8ad432f25d8817b0f9e7abb8a90ca4a (patch)
tree2e4043c81d5db5e6439c4b98fa8e35f83cbae1d5
parentae09d05d07fb980ecc5c561cfcd6cadc0ba36b2c (diff)
downloadtqt-Fat-Zer/fix/tqlocale-warning.tar.gz
tqt-Fat-Zer/fix/tqlocale-warning.zip
Fix a -Wlogical-not-parentheses warningFat-Zer/fix/tqlocale-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 quickly return 32 and not to bother shifting the value. Initially the condition were likely supposed to be `if (!(x & 1))` and the number were shifted, but 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 <fatzer2@gmail.com>
-rw-r--r--src/tools/tqlocale.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/tqlocale.cpp b/src/tools/tqlocale.cpp
index e3ab4305d..9cdffb4f2 100644
--- a/src/tools/tqlocale.cpp
+++ b/src/tools/tqlocale.cpp
@@ -4429,8 +4429,8 @@ static int lo0bits(ULong *y)
}
if (!(x & 1)) {
k++;
- x >>= 1;
- if (!x & 1)
+ // At this point x is zero if and only if the *y was zero
+ if (!x)
return 32;
}
*y = x;