From ee1d80da6a2c35573a36a010a6076830ce3fc098 Mon Sep 17 00:00:00 2001 From: Eric Joldasov Date: Thu, 13 Feb 2025 22:51:35 +0500 Subject: [PATCH] `std.fmt.digits` now accept u8 instead of usize See https://github.com/ziglang/zig/pull/22864 . Signed-off-by: Eric Joldasov --- src/json_export.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/json_export.zig b/src/json_export.zig index 222a26f..95ccf85 100644 --- a/src/json_export.zig +++ b/src/json_export.zig @@ -126,14 +126,14 @@ pub const Writer = struct { var index: usize = buf.len; while (a >= 100) : (a = @divTrunc(a, 100)) { index -= 2; - buf[index..][0..2].* = std.fmt.digits2(@as(usize, @intCast(a % 100))); + buf[index..][0..2].* = std.fmt.digits2(@as(u8, @intCast(a % 100))); } if (a < 10) { index -= 1; buf[index] = '0' + @as(u8, @intCast(a)); } else { index -= 2; - buf[index..][0..2].* = std.fmt.digits2(@as(usize, @intCast(a))); + buf[index..][0..2].* = std.fmt.digits2(@as(u8, @intCast(a))); } ctx.write(buf[index..]); }