From e2128bb9f2102ed9f38298081a97914ce5bf9294 Mon Sep 17 00:00:00 2001 From: bendn Date: Tue, 5 Sep 2023 17:56:30 +0700 Subject: [PATCH] fix affine bench --- benches/affine_transformations.rs | 5 +++-- src/affine.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/benches/affine_transformations.rs b/benches/affine_transformations.rs index ac68d6e..1b38428 100644 --- a/benches/affine_transformations.rs +++ b/benches/affine_transformations.rs @@ -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(); } }); } diff --git a/src/affine.rs b/src/affine.rs index f50ba30..7404293 100644 --- a/src/affine.rs +++ b/src/affine.rs @@ -27,7 +27,7 @@ impl 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;