rivertile: eliminate an @intCast()

It's pretty cool that the new @min() and @max() builtin semantics allow
this.
This commit is contained in:
Isaac Freund 2023-10-26 00:04:11 +02:00
parent 4cb65f9e2e
commit 5da4769c23
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -415,5 +415,5 @@ fn fatalPrintUsage(comptime format: []const u8, args: anytype) noreturn {
} }
fn saturatingCast(comptime T: type, x: anytype) T { 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));
} }