diff options
| author | Jeremiah <barrar@users.noreply.github.com> | 2017-05-13 19:07:05 -0700 |
|---|---|---|
| committer | Jeremiah <barrar@users.noreply.github.com> | 2017-05-13 19:07:05 -0700 |
| commit | 63d9698d5c7a088b2eb8220a9a44c8adbca86326 (patch) | |
| tree | 163bed69e4f9f2467406aa52eefd684ab8bb4a84 /tmk_core | |
| parent | 37f6f92765513cd66c92178f48785d492eb06b89 (diff) | |
| download | qmk_firmware-63d9698d5c7a088b2eb8220a9a44c8adbca86326.tar.gz qmk_firmware-63d9698d5c7a088b2eb8220a9a44c8adbca86326.zip | |
faster and less bits... again
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common/keyboard.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index d8b5dc403..fa17ffca2 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -74,20 +74,19 @@ static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata){ | |||
| 74 | return out; | 74 | return out; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | 77 | static inline bool countones(matrix_row_t row) | |
| 78 | static inline bool countones(matrix_row_t data) | ||
| 79 | { | 78 | { |
| 80 | int count = 0; | 79 | int count = 0; |
| 81 | for (int col = 0; col < MATRIX_COLS; col++) { | 80 | while (row > 0){ |
| 82 | if (data & (1<<col)){ | 81 | count += 1; |
| 83 | count++; | 82 | row &= row-1; |
| 84 | } | ||
| 85 | } | 83 | } |
| 86 | if (count > 1){ | 84 | if (count > 1){ |
| 87 | return true; | 85 | return true; |
| 88 | } | 86 | } |
| 89 | return false; | 87 | return false; |
| 90 | } | 88 | } |
| 89 | |||
| 91 | static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata) | 90 | static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata) |
| 92 | { | 91 | { |
| 93 | rowdata = get_real_keys(row, rowdata); | 92 | rowdata = get_real_keys(row, rowdata); |
