Commit b837855317

J87 <68929154+jake-87@users.noreply.github.com>
2022-02-18 03:17:32
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.
1 parent 5aa35f6
Changed files (1)
lib
std
lib/std/math/fabs.zig
@@ -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);
 }