authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-03-20 11:39:30 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-03-20 11:39:30 -07:00
log550cabd5a18ace5e67761bc5b867c10e926f4314
tree23333759c85a634096d8e672a5b258efa6c83986
parentab852cf74fa0b4edc530d925f0654b62c60365bf

update to zig master 0.11.0-dev.1681+0bb178bbb


1 files changed, 3 insertions(+), 3 deletions(-)

src/lib.zig+3-3
...@@ -53,17 +53,17 @@ pub fn leven(comptime T: type, alloc: std.mem.Allocator, a: []const T, b: []cons...@@ -53,17 +53,17 @@ pub fn leven(comptime T: type, alloc: std.mem.Allocator, a: []const T, b: []cons
53 const array = try alloc.alloc(usize, ll);53 const array = try alloc.alloc(usize, ll);
54 defer alloc.free(array);54 defer alloc.free(array);
5555
56 for (range(ll)) |_, i| {56 for (range(ll), 0..) |_, i| {
57 charCodeCache[i] = left[start + i];57 charCodeCache[i] = left[start + i];
58 array[i] = i + 1;58 array[i] = i + 1;
59 }59 }
6060
61 for (range(rl)) |_, j| {61 for (range(rl), 0..) |_, j| {
62 const bCharCode = right[start + j];62 const bCharCode = right[start + j];
63 var temp = j;63 var temp = j;
64 result = j + 1;64 result = j + 1;
6565
66 for (range(ll)) |_, i| {66 for (range(ll), 0..) |_, i| {
67 const temp2 = if (bCharCode == charCodeCache[i]) temp else temp + 1;67 const temp2 = if (bCharCode == charCodeCache[i]) temp else temp + 1;
68 temp = array[i];68 temp = array[i];
69 array[i] = if (temp > result) (if (temp2 > result) result + 1 else temp2) else (if (temp2 > temp) temp + 1 else temp2);69 array[i] = if (temp > result) (if (temp2 > result) result + 1 else temp2) else (if (temp2 > temp) temp + 1 else temp2);