From: Mark Wooding Date: Sun, 30 Mar 2025 20:25:58 +0000 (+0100) Subject: chain.c: Use `short' for word and chain lengths, except for QP tries. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/wordchain/commitdiff_plain/4d4489e372b27a411a5d1e61a68b86b025079315?ds=inline chain.c: Use `short' for word and chain lengths, except for QP tries. The maximum word length is 64 bytes, and the chain length is bounded by the word length. We're sort-of forced into `size_t' for the word length with QP tries, because `Tnextl' wants to store the key length through a pointer. --- diff --git a/chain.c b/chain.c index 77e9e63..6933feb 100644 --- a/chain.c +++ b/chain.c @@ -170,7 +170,14 @@ # endif #endif -struct word { const char *p; size_t n; } word; +struct word { + const char *p; +#if USE_QPTRIE + size_t n; +#else + unsigned short n; +#endif +} word; struct node { #if USE_XYLA @@ -185,7 +192,7 @@ struct node { struct word w; #endif struct node *down, *right, *up; - int len; + short len; }; #define WORDMAX 64