rivertile: Use saturating addition

This commit is contained in:
Hugo Machet 2022-01-13 13:08:42 +01:00 committed by Isaac Freund
parent c9fd8b3f37
commit 0bdf348883

View File

@ -170,11 +170,7 @@ const Output = struct {
return;
};
switch (raw_arg[0]) {
'+' => output.main_count = math.add(
u32,
output.main_count,
@intCast(u32, arg),
) catch math.maxInt(u32),
'+' => output.main_count +|= @intCast(u32, arg),
'-' => {
const result = @as(i33, output.main_count) + arg;
if (result >= 0) output.main_count = @intCast(u32, result);