From 5c8e22a0431ab983589e9656c408adede1b2e8a4 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 16 Aug 2023 21:33:21 -0700 Subject: [PATCH] update to Zig 0.11 --- base32.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/base32.zig b/base32.zig index 183add841a1202ea4ff7da32d9744b213e1d89a7..bd8558e3fb34602d5675eb23e646996350521c70 100644 --- a/base32.zig +++ b/base32.zig @@ -11,9 +11,9 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 { errdefer list.deinit(); for (input) |c| { - for (alphabet) |d, i| { + for (alphabet, 0..) |d, i| { if (c == d) { - try list.append(@intCast(u5, i)); + try list.append(@intCast(i)); } } } @@ -21,14 +21,14 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 { } pub fn formatInt(comptime T: type, n: T, buf: []u8) void { - const l = @intCast(T, alphabet.len); + const l: T = @intCast(alphabet.len); var x = n; var i = buf.len; - for (range(i)) |_, j| { + for (0..i) |j| { buf[j] = alphabet[0]; } while (true) { - const a = @intCast(usize, x % l); + const a: usize = @intCast(x % l); x = x / l; buf[i - 1] = alphabet[a]; i -= 1; -- 2.54.0