rivertile: eliminate an @intCast()
It's pretty cool that the new @min() and @max() builtin semantics allow this.
This commit is contained in:
parent
4cb65f9e2e
commit
5da4769c23
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user