From 6f56cb9b2b99f9afc8b0234aa47612e5594676d5 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 2 Jan 2020 17:06:01 +0100 Subject: [PATCH] device/Raise: Fix the pressed key switch counting `RaiseKeyScanner::pressedKeyswitchCount` and `::previousPressedKeyswitchCount()` used `__builtin_popcountl` to count the bits set in the left and right hand states, but that only looks at 32 bits out of the 64 we have in each half. We should be using `__builtin_popcountll` instead. Signed-off-by: Gergely Nagy --- src/kaleidoscope/device/dygma/Raise.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/device/dygma/Raise.cpp b/src/kaleidoscope/device/dygma/Raise.cpp index 7448f8ed..42465d45 100644 --- a/src/kaleidoscope/device/dygma/Raise.cpp +++ b/src/kaleidoscope/device/dygma/Raise.cpp @@ -392,11 +392,11 @@ bool RaiseKeyScanner::wasKeyswitchPressed(KeyAddr key_addr) { } uint8_t RaiseKeyScanner::pressedKeyswitchCount() { - return __builtin_popcountl(leftHandState.all) + __builtin_popcountl(rightHandState.all); + return __builtin_popcountll(leftHandState.all) + __builtin_popcountll(rightHandState.all); } uint8_t RaiseKeyScanner::previousPressedKeyswitchCount() { - return __builtin_popcountl(previousLeftHandState.all) + __builtin_popcountl(previousRightHandState.all); + return __builtin_popcountll(previousLeftHandState.all) + __builtin_popcountll(previousRightHandState.all); } void RaiseKeyScanner::setKeyscanInterval(uint8_t interval) {