forrestthewoods / lib_fts

single-file public domain libraries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typo in "apply unmatched penalty"

bubnikv opened this issue · comments

        // Apply unmatched penalty

It is
int unmatched = (int)(str - strBegin) - nextMatch;

where nextMatch is a pointer into matches, so the expression above mixes apples with oranges. IMHO it should be

        int unmatched = (int)(str - strBegin) - matches[nextMatch-1] + 1;

Thanks for a great library, we are going to use it in
https://www.prusa3d.com/prusaslicer/
https://github.com/prusa3d/PrusaSlicer

Forget it, I did not understand the condition. It calculates number of unmatched characters, however my proposal while being valid as well counts the number of unmatched characters after the last matched character.