authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-16 21:33:21 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-16 21:33:21 -07:00
log5c8e22a0431ab983589e9656c408adede1b2e8a4
treebd32cb1ddd7fb2c8e652870040220c1941c5a59b
parent7f2c7edf0e7f91229be17bda52d0e74d42d862e2

update to Zig 0.11


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

base32.zig+5-5
...@@ -11,9 +11,9 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 {...@@ -11,9 +11,9 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 {
11 errdefer list.deinit();11 errdefer list.deinit();
1212
13 for (input) |c| {13 for (input) |c| {
14 for (alphabet) |d, i| {14 for (alphabet, 0..) |d, i| {
15 if (c == d) {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,14 +21,14 @@ pub fn decode(alloc: std.mem.Allocator, input: string) ![]const u5 {
21}21}
2222
23pub fn formatInt(comptime T: type, n: T, buf: []u8) void {23pub 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 var x = n;25 var x = n;
26 var i = buf.len;26 var i = buf.len;
27 for (range(i)) |_, j| {27 for (0..i) |j| {
28 buf[j] = alphabet[0];28 buf[j] = alphabet[0];
29 }29 }
30 while (true) {30 while (true) {
31 const a = @intCast(usize, x % l);31 const a: usize = @intCast(x % l);
32 x = x / l;32 x = x / l;
33 buf[i - 1] = alphabet[a];33 buf[i - 1] = alphabet[a];
34 i -= 1;34 i -= 1;