diff options
| author | hikari <ftphikari@gmail.com> | 2022-04-21 20:58:50 +0300 |
|---|---|---|
| committer | hikari <ftphikari@gmail.com> | 2022-04-21 20:58:50 +0300 |
| commit | 591732f347c094e706471994996fcffa44687e89 (patch) | |
| tree | 357b8bf0a700dcfeaad951eedc46449acddfeb65 /core/strings | |
| parent | eee97f7f62bbd65dd03ea3ec8668fef3fcfc685c (diff) | |
strings: levenshtein_distance: remove costs calculation for default array
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/strings.odin | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 87bbb42cf..3b33a5dc8 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -1833,6 +1833,9 @@ levenshtein_distance :: proc(a, b: string, allocator := context.allocator) -> in if n + 1 > len(LEVENSHTEIN_DEFAULT_COSTS) { costs = make([]int, n + 1, allocator) + for k in 0..=n { + costs[k] = k + } } else { costs = LEVENSHTEIN_DEFAULT_COSTS } @@ -1841,10 +1844,6 @@ levenshtein_distance :: proc(a, b: string, allocator := context.allocator) -> in delete(costs, allocator) } - for k in 0..=n { - costs[k] = k - } - i: int for c1 in a { costs[0] = i + 1 |