Skip to content

Commit

Permalink
rivertile: Use saturating addition
Browse files Browse the repository at this point in the history
  • Loading branch information
novakne authored and ifreund committed Jan 14, 2022
1 parent c9fd8b3 commit 0bdf348
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions rivertile/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0bdf348

Please sign in to comment.