From 5da4769c2357072771e89f00bdd68098b2ef3660 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 26 Oct 2023 00:04:11 +0200 Subject: rivertile: eliminate an @intCast() It's pretty cool that the new @min() and @max() builtin semantics allow this. --- rivertile/main.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rivertile') diff --git a/rivertile/main.zig b/rivertile/main.zig index ec6205d..a2caf8e 100644 --- a/rivertile/main.zig +++ b/rivertile/main.zig @@ -415,5 +415,5 @@ fn fatalPrintUsage(comptime format: []const u8, args: anytype) noreturn { } fn saturatingCast(comptime T: type, x: anytype) T { - return @intCast(math.clamp(x, math.minInt(T), math.maxInt(T))); + return @max(math.minInt(T), @min(math.maxInt(T), x)); } -- cgit v1.2.3