fix(container/layout): integer overflows by casting to usize
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m5s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m5s
This commit is contained in:
@@ -346,8 +346,8 @@ pub const Layout = packed struct {
|
|||||||
for (0..children.len - 1) |idx| {
|
for (0..children.len - 1) |idx| {
|
||||||
const child = children[idx];
|
const child = children[idx];
|
||||||
const anchor = switch (this.direction) {
|
const anchor = switch (this.direction) {
|
||||||
.horizontal => ((child.size.anchor.row -| size.anchor.row) * size.cols) + child.size.anchor.col + child.size.cols + gap -| size.anchor.col,
|
.horizontal => ((@as(usize, child.size.anchor.row) -| @as(usize, size.anchor.row)) * @as(usize, size.cols)) + @as(usize, child.size.anchor.col) + @as(usize, child.size.cols) + gap -| @as(usize, size.anchor.col),
|
||||||
.vertical => ((child.size.anchor.row + child.size.rows + gap -| size.anchor.row) * size.cols) + child.size.anchor.col -| size.anchor.col,
|
.vertical => ((@as(usize, child.size.anchor.row) + @as(usize, child.size.rows) + gap -| @as(usize, size.anchor.row)) * @as(usize, size.cols)) + @as(usize, child.size.anchor.col) -| @as(usize, size.anchor.col),
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (this.direction) {
|
switch (this.direction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user