Skip to content

Commit

Permalink
image: use else for other non-int types
Browse files Browse the repository at this point in the history
  • Loading branch information
arrufat committed Dec 7, 2024
1 parent e6d4334 commit ac73199
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/image.zig
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub fn Image(comptime T: type) type {
const sum = integral.data[pos22] - integral.data[pos21] - integral.data[pos12] + integral.data[pos11];
blurred.data[pos] = switch (@typeInfo(T)) {
.int => @intFromFloat(@max(std.math.minInt(T), @min(std.math.maxInt(T), (@round(sum / area))))),
.float => as(T, sum / area),
else => as(T, sum / area),
};
pos += 1;
rem -= 1;
Expand Down Expand Up @@ -424,7 +424,7 @@ pub fn Image(comptime T: type) type {
const sum = integral.data[pos22] - integral.data[pos21] - integral.data[pos12] + integral.data[pos11];
sharpened.data[pos] = switch (@typeInfo(T)) {
.int => @intFromFloat(@max(std.math.minInt(T), @min(std.math.maxInt(T), @round(sum / area)))),
.float => as(T, sum / area),
else => as(T, sum / area),
};
pos += 1;
rem -= 1;
Expand Down

0 comments on commit ac73199

Please sign in to comment.