mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 00:35:10 +00:00
Replace magic numbers with clearer representation
Replaces two magic numbers with the procedure used to generate them, in order to keep consistent with other implementations for f64 & f128.
This commit is contained in:
parent
5aa35f62c3
commit
b837855317
@ -27,13 +27,13 @@ pub fn fabs(x: anytype) @TypeOf(x) {
|
||||
|
||||
fn fabs16(x: f16) f16 {
|
||||
var u = @bitCast(u16, x);
|
||||
u &= 0x7FFF;
|
||||
u &= maxInt(u16) >> 1;
|
||||
return @bitCast(f16, u);
|
||||
}
|
||||
|
||||
fn fabs32(x: f32) f32 {
|
||||
var u = @bitCast(u32, x);
|
||||
u &= 0x7FFFFFFF;
|
||||
u &= maxInt(u32) >> 1;
|
||||
return @bitCast(f32, u);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user