From 9bed332fe916ac0f452fb1972c19ecacd77f882e Mon Sep 17 00:00:00 2001 From: Ruben Carlo Benante Date: Fri, 22 May 2026 21:30:10 -0300 Subject: [PATCH] fast path if threshold>=1.0 --- lib11sht.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib11sht.c b/lib11sht.c index 1a1f2c0..98c8db7 100644 --- a/lib11sht.c +++ b/lib11sht.c @@ -79,6 +79,14 @@ int sequal_full(char *a, char *b, float shold, float *ratio, *ratio = 1.0; return 0; } + if(shold >= 1.0f) + { + /* strict mode: shold=1.0 means no fuzzy match possible + * (shit11 ratio is always <= 1.0, never > 1.0). Skip the + * Levenshtein DP entirely. */ + *ratio = 0.0f; + return (cmp < 0) ? -1 : 1; + } *ratio = shit11(s1, s2); if(*ratio > shold) return 0;