aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
diff options
context:
space:
mode:
authorJeremy Hertel <dev@jhert.com>2024-08-29 22:26:07 -0500
committerVeikka Tuominen <git@vexu.eu>2024-09-02 00:10:22 +0300
commit227fb4875f5084cdb3436c40c4a08809bd3e4f50 (patch)
treee323903b66e7ac5c98935ae811d1467aecea69b9 /lib/std/math.zig
parent28383d4d985cd04c897f6b6a63bd2107d8e2a8e9 (diff)
downloadzig-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.zig24
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.