From 58004c7c18baae9374f857f07844fa14b56c9644 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 27 Oct 2023 12:17:10 -0400 Subject: typo: Shrink the key_coords table --- src/typo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/typo.c') diff --git a/src/typo.c b/src/typo.c index 305711d..b1c5c44 100644 --- a/src/typo.c +++ b/src/typo.c @@ -3,11 +3,12 @@ #include "typo.h" #include +#include #include #include // 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]); -- cgit v1.2.3