Merge pull request #28 from keyboardio/o/pressedKeyswitchCount

Use __builtin_popcountl() in pressedKeyswitchCount()
pull/365/head
Jesse Vincent 6 years ago committed by GitHub
commit d8839bb991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -287,13 +287,7 @@ bool Model01::isKeyswitchPressed(uint8_t keyIndex) {
}
uint8_t Model01::pressedKeyswitchCount() {
uint8_t count = 0;
for (uint8_t i = 0; i < 32; i++) {
count += bitRead(leftHandState.all, i) + bitRead(rightHandState.all, i);
}
return count;
return __builtin_popcountl(leftHandState.all) + __builtin_popcountl(rightHandState.all);
}
HARDWARE_IMPLEMENTATION KeyboardHardware;

Loading…
Cancel
Save