fix: do not use @divExact as the exact division cannot be garantueed from the caller
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m41s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m41s
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user