Skip to content

Commit 8b32daa

Browse files
committed
std.process: fix compilation on 32-bit targets
1 parent 0607e7c commit 8b32daa

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

lib/std/process.zig

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,11 +1836,15 @@ pub fn createEnvironFromMap(
18361836
break :a .nothing;
18371837
};
18381838

1839-
const envp_count: usize = @intCast(@as(isize, map.count()) + @as(isize, switch (zig_progress_action) {
1840-
.add => 1,
1841-
.delete => -1,
1842-
.nothing, .edit => 0,
1843-
}));
1839+
const envp_count: usize = c: {
1840+
var count: usize = map.count();
1841+
switch (zig_progress_action) {
1842+
.add => count += 1,
1843+
.delete => count -= 1,
1844+
.nothing, .edit => {},
1845+
}
1846+
break :c count;
1847+
};
18441848

18451849
const envp_buf = try arena.allocSentinel(?[*:0]u8, envp_count, null);
18461850
var i: usize = 0;
@@ -1901,11 +1905,15 @@ pub fn createEnvironFromExisting(
19011905
break :a .nothing;
19021906
};
19031907

1904-
const envp_count: usize = @intCast(@as(isize, @intCast(existing_count)) + @as(isize, switch (zig_progress_action) {
1905-
.add => 1,
1906-
.delete => -1,
1907-
.nothing, .edit => 0,
1908-
}));
1908+
const envp_count: usize = c: {
1909+
var count: usize = existing_count;
1910+
switch (zig_progress_action) {
1911+
.add => count += 1,
1912+
.delete => count -= 1,
1913+
.nothing, .edit => {},
1914+
}
1915+
break :c count;
1916+
};
19091917

19101918
const envp_buf = try arena.allocSentinel(?[*:0]u8, envp_count, null);
19111919
var i: usize = 0;

0 commit comments

Comments
 (0)