From 05277a226aaca14766f092ed9c3fb0f084f0218a Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Wed, 27 Nov 2024 15:10:39 +0100 Subject: [PATCH] fix: do not use @divExact as the exact division cannot be garantueed from the caller --- src/widget/Text.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widget/Text.zig b/src/widget/Text.zig index 9a5f977..a823470 100644 --- a/src/widget/Text.zig +++ b/src/widget/Text.zig @@ -65,7 +65,7 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type { } const length: u16 = @truncate(length_usize); const cols = @min(length, this.size.cols); - const rows = @divExact(cols, length); + const rows = cols / length; break :blk .{ .anchor = .{ .col = this.size.anchor.col + @divTrunc(this.size.cols, 2) - @divTrunc(cols, 2), @@ -82,7 +82,7 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type { } const length: u16 = @truncate(length_usize); const cols = @min(length, this.size.cols); - const rows = @divExact(cols, length); + const rows = cols / length; break :blk .{ .anchor = .{ .col = this.size.anchor.col + @divTrunc(this.size.cols, 2) - @divTrunc(cols, 2), @@ -99,7 +99,7 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type { } const length: u16 = @truncate(length_usize); const cols = @min(length, this.size.cols); - const rows = @divExact(cols, length); + const rows = cols / length; break :blk .{ .anchor = .{ .col = this.size.anchor.col + @divTrunc(this.size.cols, 2) - @divTrunc(cols, 2), @@ -116,7 +116,7 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type { } const length: u16 = @truncate(length_usize); const cols = @min(length, this.size.cols); - const rows = @divExact(cols, length); + const rows = cols / length; break :blk .{ .anchor = .{ .col = this.size.anchor.col, @@ -133,7 +133,7 @@ pub fn Widget(comptime Event: type, comptime Renderer: type) type { } const length: u16 = @truncate(length_usize); const cols = @min(length, this.size.cols); - const rows = @divExact(cols, length); + const rows = cols / length; break :blk .{ .anchor = .{ .col = this.size.anchor.col + this.size.cols - cols,