mirror of
https://github.com/ziglang/zig.git
synced 2026-02-18 07:18:38 +00:00
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.
This commit is contained in:
parent
3b9ec4e4df
commit
4f0aa7d639
@ -348,7 +348,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;
|
||||
|
||||
@ -741,7 +741,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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user