diff options
| author | Jeremy Hertel <dev@jhert.com> | 2024-08-29 22:26:07 -0500 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2024-09-02 00:10:22 +0300 |
| commit | 227fb4875f5084cdb3436c40c4a08809bd3e4f50 (patch) | |
| tree | e323903b66e7ac5c98935ae811d1467aecea69b9 /lib/std/math.zig | |
| parent | 28383d4d985cd04c897f6b6a63bd2107d8e2a8e9 (diff) | |
| download | zig-227fb4875f5084cdb3436c40c4a08809bd3e4f50.tar.gz zig-227fb4875f5084cdb3436c40c4a08809bd3e4f50.zip | |
std.math: rename make_f80 to F80.toFloat and break_f80 to F80.fromFloat
Diffstat (limited to 'lib/std/math.zig')
| -rw-r--r-- | lib/std/math.zig | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig index 67782bf93b..1e7858aaa9 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -1720,20 +1720,20 @@ pub fn comptimeMod(num: anytype, comptime denom: comptime_int) IntFittingRange(0 pub const F80 = struct { fraction: u64, exp: u16, -}; -pub fn make_f80(repr: F80) f80 { - const int = (@as(u80, repr.exp) << 64) | repr.fraction; - return @as(f80, @bitCast(int)); -} + pub fn toFloat(self: F80) f80 { + const int = (@as(u80, self.exp) << 64) | self.fraction; + return @as(f80, @bitCast(int)); + } -pub fn break_f80(x: f80) F80 { - const int = @as(u80, @bitCast(x)); - return .{ - .fraction = @as(u64, @truncate(int)), - .exp = @as(u16, @truncate(int >> 64)), - }; -} + pub fn fromFloat(x: f80) F80 { + const int = @as(u80, @bitCast(x)); + return .{ + .fraction = @as(u64, @truncate(int)), + .exp = @as(u16, @truncate(int >> 64)), + }; + } +}; /// Returns -1, 0, or 1. /// Supports integer and float types and vectors of integer and float types. |
