Skip to content

Commit

Permalink
geometry: fix rectangle width computation
Browse files Browse the repository at this point in the history
  • Loading branch information
arrufat committed Jul 25, 2024
1 parent a9b9e00 commit cc1ade1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/geometry.zig
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn Rectangle(comptime T: type) type {
pub fn width(self: Self) if (@typeInfo(T) == .Int) usize else T {
return if (self.isEmpty()) 0 else switch (@typeInfo(T)) {
.Int => @intCast(self.r - self.l + 1),
.Float => self.b - self.t,
.Float => self.r - self.l,
else => @compileError("Unsupported type " ++ @typeName(T) ++ " for Rectangle"),
};
}
Expand Down

0 comments on commit cc1ade1

Please sign in to comment.