mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 23:33:15 +00:00
strings: levenshtein_distance: remove costs calculation for default array
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user