authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-10-15 11:46:47-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-10-15 11:46:47-07:00
log0915d24e6b34b67d358c1309e9bc8516416f1008
tree711578f68083d711560bd968e23bf1549690bd04
parent01b390568872344e53862d61da091071e0ab1f3e

std.os: add workarounds for stage1 `@minimum` implementation


1 files changed, 6 insertions(+), 2 deletions(-)

lib/std/os.zig+6-2
......@@ -5601,7 +5601,9 @@ pub fn sendfile(
56015601 hdtr = &hdtr_data;
56025602 }
56035603
5604 const adjusted_count = @minimum(in_len, @as(u63, max_count));
5604 const adjusted_count_temporary = @minimum(in_len, @as(u63, max_count));
5605 // TODO we should not need this int cast; improve the return type of `@minimum`
5606 const adjusted_count = @intCast(u63, adjusted_count_temporary);
56055607
56065608 while (true) {
56075609 var sbytes: off_t = adjusted_count;
......@@ -5655,7 +5657,9 @@ pub fn sendfile(
56555657 rw: {
56565658 var buf: [8 * 4096]u8 = undefined;
56575659 // Here we match BSD behavior, making a zero count value send as many bytes as possible.
5658 const adjusted_count = if (in_len == 0) buf.len else @minimum(buf.len, in_len);
5660 const adjusted_count_tmp = if (in_len == 0) buf.len else @minimum(buf.len, in_len);
5661 // TODO we should not need this cast; improve return type of @minimum
5662 const adjusted_count = @intCast(usize, adjusted_count_tmp);
56595663 const amt_read = try pread(in_fd, buf[0..adjusted_count], in_offset);
56605664 if (amt_read == 0) {
56615665 if (in_len == 0) {