···58 @memset(surface.buffer, empty);
5960 // (view_size / total) * window height = size of the scroll bar
61- const bar_height = @max(std.math.divCeil(usize, self.view_size * max.height, self.total) catch unreachable, 1);
0620063 // The row of the last cell of the bottom of the bar
64- const bar_bottom = (max.height - 1) -| (std.math.divCeil(usize, self.bottom * max.height, self.total) catch unreachable);
6566 var i: usize = 0;
67 while (i <= bar_height) : (i += 1)
···58 @memset(surface.buffer, empty);
5960 // (view_size / total) * window height = size of the scroll bar
61+ const premul1 = std.math.mulWide(u16, self.view_size, max.height);
62+ const bar_height = @max(std.math.divCeil(usize, premul1, self.total) catch unreachable, 1);
6364+ // Premultiply. We use mulWide to ensure we never overflow
65+ const premul2 = std.math.mulWide(u16, self.bottom, max.height);
66 // The row of the last cell of the bottom of the bar
67+ const bar_bottom = (max.height - 1) -| (std.math.divCeil(usize, premul2, self.total) catch unreachable);
6869 var i: usize = 0;
70 while (i <= bar_height) : (i += 1)