diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-05-26 12:08:15 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-05-27 20:56:48 -0700 |
| commit | eb718ceffa0fd656a169a1dd2794e6e99bf5bcaa (patch) | |
| tree | 2b53d2b444b6fd3edc5e874dacfd92024874eab6 /lib/std/process.zig | |
| parent | e8201734677ffcbe45dac12f2439f2de8e38710d (diff) | |
| download | zig-eb718ceffa0fd656a169a1dd2794e6e99bf5bcaa.tar.gz zig-eb718ceffa0fd656a169a1dd2794e6e99bf5bcaa.zip | |
std.process: fix compilation on 32-bit targets
Diffstat (limited to 'lib/std/process.zig')
| -rw-r--r-- | lib/std/process.zig | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/std/process.zig b/lib/std/process.zig index 7d1f817337..5fb36f991d 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -1836,11 +1836,15 @@ pub fn createEnvironFromMap( break :a .nothing; }; - const envp_count: usize = @intCast(@as(isize, map.count()) + @as(isize, switch (zig_progress_action) { - .add => 1, - .delete => -1, - .nothing, .edit => 0, - })); + const envp_count: usize = c: { + var count: usize = map.count(); + switch (zig_progress_action) { + .add => count += 1, + .delete => count -= 1, + .nothing, .edit => {}, + } + break :c count; + }; const envp_buf = try arena.allocSentinel(?[*:0]u8, envp_count, null); var i: usize = 0; @@ -1901,11 +1905,15 @@ pub fn createEnvironFromExisting( break :a .nothing; }; - const envp_count: usize = @intCast(@as(isize, @intCast(existing_count)) + @as(isize, switch (zig_progress_action) { - .add => 1, - .delete => -1, - .nothing, .edit => 0, - })); + const envp_count: usize = c: { + var count: usize = existing_count; + switch (zig_progress_action) { + .add => count += 1, + .delete => count -= 1, + .nothing, .edit => {}, + } + break :c count; + }; const envp_buf = try arena.allocSentinel(?[*:0]u8, envp_count, null); var i: usize = 0; |
