Fix bit count calculation for iterating layers

master
Ryan Caltabiano 2019-05-18 15:12:35 -05:00 committed by Drashna Jaelre
parent d85110b6ec
commit ba26736d7e
1 changed files with 1 additions and 1 deletions

View File

@ -303,7 +303,7 @@ uint8_t layer_switch_get_layer(keypos_t key) {
layer_state_t layers = layer_state | default_layer_state; layer_state_t layers = layer_state | default_layer_state;
/* check top layer first */ /* check top layer first */
for (int8_t i = sizeof(layer_state_t)-1; i >= 0; i--) { for (int8_t i = sizeof(layer_state_t) * 8 - 1; i >= 0; i--) {
if (layers & (1UL << i)) { if (layers & (1UL << i)) {
action = action_for_key(i, key); action = action_for_key(i, key);
if (action.code != ACTION_TRANSPARENT) { if (action.code != ACTION_TRANSPARENT) {