diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-10-27 12:17:10 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-10-27 12:17:10 -0400 |
commit | 58004c7c18baae9374f857f07844fa14b56c9644 (patch) | |
tree | 18b753254beb91e803dd1964453206ce1fa803b5 /src/typo.c | |
parent | 0015289fec2c54de481cab87fb5b43bc2d1f2a4a (diff) | |
download | bfs-58004c7c18baae9374f857f07844fa14b56c9644.tar.xz |
typo: Shrink the key_coords table
Diffstat (limited to 'src/typo.c')
-rw-r--r-- | src/typo.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3,11 +3,12 @@ #include "typo.h" #include <limits.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> // Assume QWERTY layout for now -static const int key_coords[UCHAR_MAX + 1][3] = { +static const int8_t key_coords[UCHAR_MAX + 1][3] = { ['`'] = { 0, 0, 0}, ['~'] = { 0, 0, 1}, ['1'] = { 3, 0, 0}, @@ -112,7 +113,7 @@ static const int key_coords[UCHAR_MAX + 1][3] = { }; static int char_distance(char a, char b) { - const int *ac = key_coords[(unsigned char)a], *bc = key_coords[(unsigned char)b]; + const int8_t *ac = key_coords[(unsigned char)a], *bc = key_coords[(unsigned char)b]; int ret = 0; for (int i = 0; i < 3; ++i) { ret += abs(ac[i] - bc[i]); |