From 0bdbe7385afeeb094588f407eac3b23467eaa92a Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 12 Feb 2017 22:34:01 +0100 Subject: [PATCH] Minor improvement for mergeLayers We fill the cached `keyMap` with the value of `DefaultLayer`, so if that is the only layer active, then we can bail out early. Signed-off-by: Gergely Nagy --- src/layers.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layers.cpp b/src/layers.cpp index a37ede50..b1bfff86 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -57,6 +57,9 @@ Layer_::mergeLayers(void) { memset (keyMap, DefaultLayer, ROWS * COLS); + if (LayerState == (uint32_t)(1 << DefaultLayer)) + return; + for (uint8_t r = 0; r < ROWS; r++) { for (uint8_t c = 0; c < COLS; c++) { int8_t layer = highestLayer;