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 <algernon@keyboard.io>
pull/782/head
Gergely Nagy 5 years ago
parent 47c1e23fed
commit 6f56cb9b2b
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -392,11 +392,11 @@ bool RaiseKeyScanner::wasKeyswitchPressed(KeyAddr key_addr) {
} }
uint8_t RaiseKeyScanner::pressedKeyswitchCount() { 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() { 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) { void RaiseKeyScanner::setKeyscanInterval(uint8_t interval) {

Loading…
Cancel
Save