diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2023-10-26 00:04:11 +0200 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2023-10-26 00:04:11 +0200 |
| commit | 5da4769c2357072771e89f00bdd68098b2ef3660 (patch) | |
| tree | a7568121f126c8ddc860eba9f555e590b8922653 /rivertile/main.zig | |
| parent | 4cb65f9e2e992a685503ce3f78b731a3bcd954ca (diff) | |
| download | river-5da4769c2357072771e89f00bdd68098b2ef3660.tar.gz river-5da4769c2357072771e89f00bdd68098b2ef3660.tar.xz | |
rivertile: eliminate an @intCast()
It's pretty cool that the new @min() and @max() builtin semantics allow
this.
Diffstat (limited to 'rivertile/main.zig')
| -rw-r--r-- | rivertile/main.zig | 2 |
1 files changed, 1 insertions, 1 deletions
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)); } |
