This commit is contained in:
2025-03-24 16:56:36 -04:00
parent b7f44d9ac0
commit b62745adec
3 changed files with 17 additions and 85 deletions

View File

@@ -11,7 +11,7 @@ impl Buf {
}
// Truncate x and y and return a corresponding index into the data slice.
fn index(&self, x: f32, y: f32) -> usize {
const fn index(&self, x: f32, y: f32) -> usize {
// x/y can come in negative, hence we shift them by width/height.
let i = (x + self.width as f32) as usize & (self.width - 1);
let j = (y + self.height as f32) as usize & (self.height - 1);