aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/bits/linux.zig
diff options
context:
space:
mode:
authorPhilip Ã…kesson <philip.akesson@gmail.com>2021-08-24 21:34:43 +0200
committerAndrew Kelley <andrew@ziglang.org>2021-08-31 22:03:54 -0400
commit4f0aa7d639e099b18df583cb984412037fbb1dbe (patch)
tree1ef3e04948909487d22bce82d65d96d362ec4001 /lib/std/os/bits/linux.zig
parent3b9ec4e4df634b17268034a6a5527c11cf67e54b (diff)
downloadzig-4f0aa7d639e099b18df583cb984412037fbb1dbe.tar.gz
zig-4f0aa7d639e099b18df583cb984412037fbb1dbe.zip
std: Use truncating cast in WIFSTOPPED for Linux, FreeBSD and DragonFly
The intermediate value can be larger than an u16, so @truncate is needed to match the behavior of musl.
Diffstat (limited to 'lib/std/os/bits/linux.zig')
-rw-r--r--lib/std/os/bits/linux.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig
index 653fb8f1e1..dfc2b5065c 100644
--- a/lib/std/os/bits/linux.zig
+++ b/lib/std/os/bits/linux.zig
@@ -1066,7 +1066,7 @@ pub fn WIFEXITED(s: u32) bool {
return WTERMSIG(s) == 0;
}
pub fn WIFSTOPPED(s: u32) bool {
- return @intCast(u16, ((s & 0xffff) *% 0x10001) >> 8) > 0x7f00;
+ return @truncate(u16, ((s & 0xffff) *% 0x10001) >> 8) > 0x7f00;
}
pub fn WIFSIGNALED(s: u32) bool {
return (s & 0xffff) -% 1 < 0xff;