From 0536c25578fa15e2326eb1061f6db61d6ad3cd65 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 15 Oct 2021 14:43:57 -0700 Subject: [PATCH] std.os: another workaround for stage1 `@minimum` behavior This is a companion commit to 0915d24e6b34b67d358c1309e9bc8516416f1008. --- lib/std/os.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/std/os.zig b/lib/std/os.zig index 1a4bd5d958..213236af45 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -5439,7 +5439,9 @@ pub fn sendfile( } // Here we match BSD behavior, making a zero count value send as many bytes as possible. - const adjusted_count = if (in_len == 0) max_count else @minimum(in_len, @as(size_t, max_count)); + const adjusted_count_tmp = if (in_len == 0) max_count else @minimum(in_len, @as(size_t, max_count)); + // TODO we should not need this cast; improve return type of @minimum + const adjusted_count = @intCast(usize, adjusted_count_tmp); const sendfile_sym = if (builtin.link_libc) system.sendfile64