aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/common/action_layer.c
diff options
context:
space:
mode:
authorGravatar Alex Ong <the.onga@gmail.com>2020-05-11 10:04:38 +1000
committerGravatar GitHub <noreply@github.com>2020-05-11 01:04:38 +0100
commit361ac2f32ac8b906dbb29cd0a6c5f971dad298c3 (patch)
treed4b8a2e2cfc464314a713f00294881fefa67f983 /tmk_core/common/action_layer.c
parentd15a60d2d318ede79746c09d5beb79ba72037f30 (diff)
downloadqmk_firmware-361ac2f32ac8b906dbb29cd0a6c5f971dad298c3.tar.gz
Optimization for scanning less layers. (#8311)
* Optimization for scanning less layers. * Rename NUM_LAYERS to MAX_LAYER.
Diffstat (limited to 'tmk_core/common/action_layer.c')
-rw-r--r--tmk_core/common/action_layer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c
index 81f86f0f3..af2d7d964 100644
--- a/tmk_core/common/action_layer.c
+++ b/tmk_core/common/action_layer.c
@@ -257,7 +257,7 @@ uint8_t layer_switch_get_layer(keypos_t key) {
layer_state_t layers = layer_state | default_layer_state;
/* check top layer first */
- for (int8_t i = sizeof(layer_state_t) * 8 - 1; i >= 0; i--) {
+ for (int8_t i = MAX_LAYER - 1; i >= 0; i--) {
if (layers & (1UL << i)) {
action = action_for_key(i, key);
if (action.code != ACTION_TRANSPARENT) {