aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/util.c')
-rw-r--r--tmk_core/common/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tmk_core/common/util.c b/tmk_core/common/util.c
index f4f018de8..861cca005 100644
--- a/tmk_core/common/util.c
+++ b/tmk_core/common/util.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include "util.h" 18#include "util.h"
19 19
20// bit population - return number of on-bit 20// bit population - return number of on-bit
21uint8_t bitpop(uint8_t bits) { 21__attribute__((noinline)) uint8_t bitpop(uint8_t bits) {
22 uint8_t c; 22 uint8_t c;
23 for (c = 0; bits; c++) bits &= bits - 1; 23 for (c = 0; bits; c++) bits &= bits - 1;
24 return c; 24 return c;
@@ -42,7 +42,7 @@ uint8_t bitpop32(uint32_t bits) {
42 42
43// most significant on-bit - return highest location of on-bit 43// most significant on-bit - return highest location of on-bit
44// NOTE: return 0 when bit0 is on or all bits are off 44// NOTE: return 0 when bit0 is on or all bits are off
45uint8_t biton(uint8_t bits) { 45__attribute__((noinline)) uint8_t biton(uint8_t bits) {
46 uint8_t n = 0; 46 uint8_t n = 0;
47 if (bits >> 4) { 47 if (bits >> 4) {
48 bits >>= 4; 48 bits >>= 4;
@@ -105,7 +105,7 @@ uint8_t biton32(uint32_t bits) {
105 return n; 105 return n;
106} 106}
107 107
108uint8_t bitrev(uint8_t bits) { 108__attribute__((noinline)) uint8_t bitrev(uint8_t bits) {
109 bits = (bits & 0x0f) << 4 | (bits & 0xf0) >> 4; 109 bits = (bits & 0x0f) << 4 | (bits & 0xf0) >> 4;
110 bits = (bits & 0b00110011) << 2 | (bits & 0b11001100) >> 2; 110 bits = (bits & 0b00110011) << 2 | (bits & 0b11001100) >> 2;
111 bits = (bits & 0b01010101) << 1 | (bits & 0b10101010) >> 1; 111 bits = (bits & 0b01010101) << 1 | (bits & 0b10101010) >> 1;