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:
J87
2022-02-18 13:17:32 +11:00
committed by Andrew Kelley
parent 5aa35f62c3
commit b837855317

View File

@@ -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);
}