We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fb2956 commit 5a9cba5Copy full SHA for 5a9cba5
src/image.zig
@@ -271,7 +271,10 @@ pub fn Image(comptime T: type) type {
271
const pos22 = r2_offset + c2;
272
const area: f32 = @floatFromInt((r2 - r1) * (c2 - c1));
273
const sum = integral.data[pos22] - integral.data[pos21] - integral.data[pos12] + integral.data[pos11];
274
- blurred.data[pos] = as(T, @round(sum / area));
+ blurred.data[pos] = switch (@typeInfo(T)) {
275
+ .Int, .ComptimeInt => as(T, @round(sum / area)),
276
+ .Float, .ComptimeFloat => as(T, sum / area),
277
+ };
278
pos += 1;
279
rem -= 1;
280
}
0 commit comments