| ... | ... | @@ -11,9 +11,9 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 { |
| 11 | 11 | errdefer list.deinit(); |
| 12 | 12 | |
| 13 | 13 | for (input) |c| { |
| 14 | | for (alphabet) |d, i| { |
| 14 | for (alphabet, 0..) |d, i| { |
| 15 | 15 | if (c == d) { |
| 16 | | try list.append(@intCast(u5, i)); |
| 16 | try list.append(@intCast(i)); |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | } |
| ... | ... | @@ -21,14 +21,14 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 { |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | pub fn formatInt(comptime T: type, n: T, buf: []u8) void { |
| 24 | | const l = @intCast(T, alphabet.len); |
| 24 | const l: T = @intCast(alphabet.len); |
| 25 | 25 | var x = n; |
| 26 | 26 | var i = buf.len; |
| 27 | | for (range(i)) |_, j| { |
| 27 | for (0..i) |j| { |
| 28 | 28 | buf[j] = alphabet[0]; |
| 29 | 29 | } |
| 30 | 30 | while (true) { |
| 31 | | const a = @intCast(usize, x % l); |
| 31 | const a: usize = @intCast(x % l); |
| 32 | 32 | x = x / l; |
| 33 | 33 | buf[i - 1] = alphabet[a]; |
| 34 | 34 | i -= 1; |