diff options
| author | Philip Ã…kesson <philip.akesson@gmail.com> | 2021-08-24 21:34:43 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-08-31 22:03:54 -0400 |
| commit | 4f0aa7d639e099b18df583cb984412037fbb1dbe (patch) | |
| tree | 1ef3e04948909487d22bce82d65d96d362ec4001 /lib/std/os/bits/linux.zig | |
| parent | 3b9ec4e4df634b17268034a6a5527c11cf67e54b (diff) | |
| download | zig-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.zig | 2 |
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; |
