aboutsummaryrefslogtreecommitdiff
path: root/src/output.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/output.zig')
-rw-r--r--src/output.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/output.zig b/src/output.zig
index cf58cbccf..cffa2c414 100644
--- a/src/output.zig
+++ b/src/output.zig
@@ -270,21 +270,21 @@ pub const ElapsedFormatter = struct {
0...std.time.ns_per_ms * 10 => {
const fmt_str = "<r><d>[{d:>.2}ms<r><d>]<r>";
switch (self.colors) {
- inline else => |colors| try writer_.print(comptime prettyFmt(fmt_str, colors), .{@floatFromInt(f64, self.duration_ns) / std.time.ns_per_ms}),
+ inline else => |colors| try writer_.print(comptime prettyFmt(fmt_str, colors), .{@as(f64, @floatFromInt(self.duration_ns)) / std.time.ns_per_ms}),
}
},
std.time.ns_per_ms * 8_000...std.math.maxInt(u64) => {
const fmt_str = "<r><d>[<r><yellow>{d:>.2}ms<r><d>]<r>";
switch (self.colors) {
- inline else => |colors| try writer_.print(comptime prettyFmt(fmt_str, colors), .{@floatFromInt(f64, self.duration_ns) / std.time.ns_per_ms}),
+ inline else => |colors| try writer_.print(comptime prettyFmt(fmt_str, colors), .{@as(f64, @floatFromInt(self.duration_ns)) / std.time.ns_per_ms}),
}
},
else => {
const fmt_str = "<r><d>[<b>{d:>.2}ms<r><d>]<r>";
switch (self.colors) {
- inline else => |colors| try writer_.print(comptime prettyFmt(fmt_str, colors), .{@floatFromInt(f64, self.duration_ns) / std.time.ns_per_ms}),
+ inline else => |colors| try writer_.print(comptime prettyFmt(fmt_str, colors), .{@as(f64, @floatFromInt(self.duration_ns)) / std.time.ns_per_ms}),
}
},
}
@@ -292,7 +292,7 @@ pub const ElapsedFormatter = struct {
};
inline fn printElapsedToWithCtx(elapsed: f64, comptime printerFn: anytype, comptime has_ctx: bool, ctx: anytype) void {
- switch (@intFromFloat(i64, @round(elapsed))) {
+ switch (@as(i64, @intFromFloat(@round(elapsed)))) {
0...1500 => {
const fmt = "<r><d>[<b>{d:>.2}ms<r><d>]<r>";
const args = .{elapsed};
@@ -328,7 +328,7 @@ pub fn printElapsedStdout(elapsed: f64) void {
}
pub fn printElapsedStdoutTrim(elapsed: f64) void {
- switch (@intFromFloat(i64, @round(elapsed))) {
+ switch (@as(i64, @intFromFloat(@round(elapsed)))) {
0...1500 => {
const fmt = "<r><d>[<b>{d:>}ms<r><d>]<r>";
const args = .{elapsed};
@@ -344,19 +344,19 @@ pub fn printElapsedStdoutTrim(elapsed: f64) void {
}
pub fn printStartEnd(start: i128, end: i128) void {
- const elapsed = @divTrunc(@truncate(i64, end - start), @as(i64, std.time.ns_per_ms));
- printElapsed(@floatFromInt(f64, elapsed));
+ const elapsed = @divTrunc(@as(i64, @truncate(end - start)), @as(i64, std.time.ns_per_ms));
+ printElapsed(@as(f64, @floatFromInt(elapsed)));
}
pub fn printStartEndStdout(start: i128, end: i128) void {
- const elapsed = @divTrunc(@truncate(i64, end - start), @as(i64, std.time.ns_per_ms));
- printElapsedStdout(@floatFromInt(f64, elapsed));
+ const elapsed = @divTrunc(@as(i64, @truncate(end - start)), @as(i64, std.time.ns_per_ms));
+ printElapsedStdout(@as(f64, @floatFromInt(elapsed)));
}
pub fn printTimer(timer: *SystemTimer) void {
if (comptime Environment.isWasm) return;
const elapsed = @divTrunc(timer.read(), @as(u64, std.time.ns_per_ms));
- printElapsed(@floatFromInt(f64, elapsed));
+ printElapsed(@as(f64, @floatFromInt(elapsed)));
}
pub noinline fn printErrorable(comptime fmt: string, args: anytype) !void {
@@ -692,7 +692,7 @@ pub const DebugTimer = struct {
var _opts = opts;
_opts.precision = 3;
std.fmt.formatFloatDecimal(
- @floatCast(f64, @floatFromInt(f64, timer.read()) / std.time.ns_per_ms),
+ @as(f64, @floatCast(@as(f64, @floatFromInt(timer.read())) / std.time.ns_per_ms)),
_opts,
writer_,
) catch unreachable;