From 6a36fc7764b1947bcd5a32318dfe47c31af12a00 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Mon, 30 Mar 2026 11:47:12 -0700 Subject: [PATCH] fix: Use logical operators with boolean arguments SonarQube flagged the use of bitwise operators with boolean variables. This is changed to use the correct logical operators instead of their bitwise equivalents. --- daemon/x52d_mouse_handler.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/x52d_mouse_handler.c b/daemon/x52d_mouse_handler.c index ea9749f..af06140 100644 --- a/daemon/x52d_mouse_handler.c +++ b/daemon/x52d_mouse_handler.c @@ -63,8 +63,8 @@ static int report_wheel(void) * hardware axis is very noisy and the firmware sends a sequence of reports * with button down, even though this is technically a momentary button. */ - scroll_up = (scroll_up ^ old_scroll_up) & scroll_up; - scroll_dn = (scroll_dn ^ old_scroll_dn) & scroll_dn; + scroll_up &&= !old_scroll_up; + scroll_dn &&= !old_scroll_dn; if (scroll_up) { // Scroll up event @@ -215,9 +215,9 @@ void x52d_mouse_report_event(libx52io_report *report) } state_changed = false; - state_changed |= (0 == report_button_change(VKM_MOUSE_BTN_LEFT, LIBX52IO_BTN_MOUSE_PRIMARY)); - state_changed |= (0 == report_button_change(VKM_MOUSE_BTN_RIGHT, LIBX52IO_BTN_MOUSE_SECONDARY)); - state_changed |= (0 == report_wheel()); + state_changed ||= (0 == report_button_change(VKM_MOUSE_BTN_LEFT, LIBX52IO_BTN_MOUSE_PRIMARY)); + state_changed ||= (0 == report_button_change(VKM_MOUSE_BTN_RIGHT, LIBX52IO_BTN_MOUSE_SECONDARY)); + state_changed ||= (0 == report_wheel()); if (state_changed) { report_sync();