strings: levenshtein_distance: remove costs calculation for default array

This commit is contained in:
hikari
2022-04-21 20:58:50 +03:00
parent eee97f7f62
commit 591732f347

View File

@@ -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