aboutsummaryrefslogtreecommitdiff
path: root/core/strings
diff options
context:
space:
mode:
authorhikari <ftphikari@gmail.com>2022-04-21 20:58:50 +0300
committerhikari <ftphikari@gmail.com>2022-04-21 20:58:50 +0300
commit591732f347c094e706471994996fcffa44687e89 (patch)
tree357b8bf0a700dcfeaad951eedc46449acddfeb65 /core/strings
parenteee97f7f62bbd65dd03ea3ec8668fef3fcfc685c (diff)
strings: levenshtein_distance: remove costs calculation for default array
Diffstat (limited to 'core/strings')
-rw-r--r--core/strings/strings.odin7
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