fix affine bench

This commit is contained in:
bendn 2023-09-05 17:56:30 +07:00
parent fd41988c10
commit e2128bb9f2
No known key found for this signature in database
GPG key ID: 0D9D3A2A3B2A93D6
2 changed files with 4 additions and 3 deletions

View file

@ -12,9 +12,10 @@ macro_rules! bench {
64.try_into().unwrap(),
include_bytes!("4_180x180.imgbuf").to_vec(),
);
b.iter(|| {
#[allow(unused_unsafe)]
b.iter(|| unsafe {
for _ in 0..256 {
img.flip_h();
img.$fn();
}
});
}

View file

@ -27,7 +27,7 @@ impl<const CHANNELS: usize> Image<&mut [u8], CHANNELS> {
}
/// Flip a image horizontally.
fn flip_h(&mut self) {
pub fn flip_h(&mut self) {
for y in 0..self.height() {
for x in 0..self.width() / 2 {
let x2 = self.width() - x - 1;