1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-23 18:06:20 +04:00

Calculate using usize. Didn't do the math, but this seems a safer option.

This commit is contained in:
Stephen Marz 2020-05-23 08:48:29 -04:00
parent 1ee1250b9d
commit af3527b081

View File

@ -280,9 +280,9 @@ static mut GPU_DEVICES: [Option<Device>; 8] = [
pub fn test_draw(buffer: *mut Pixel, r: Rect, color: Pixel) {
for row in r.y..(r.y+r.height) {
for col in r.x..(r.x+r.width) {
let byte = row * 640 + col;
let byte = row as usize * 640 + col as usize;
unsafe {
buffer.add(byte as usize).write(color);
buffer.add(byte).write(color);
}
}
}