From 3e4c97243d6ab8ae569292925f5ce6ef4260b000 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Tue, 24 Sep 2024 10:04:36 +0200 Subject: [PATCH] refactor: less #[inline(always)] --- src/hsl.rs | 10 +++++----- src/linear_rgb.rs | 10 +++++----- src/math.rs | 12 ++++++------ src/rgb.rs | 14 +++++++------- src/xyb.rs | 10 +++++----- src/yuv.rs | 8 ++++---- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/hsl.rs b/src/hsl.rs index 3539ebc..5be5503 100644 --- a/src/hsl.rs +++ b/src/hsl.rs @@ -42,31 +42,31 @@ impl Hsl { } #[must_use] - #[inline(always)] + #[inline] pub fn data(&self) -> &[[f32; 3]] { &self.data } #[must_use] - #[inline(always)] + #[inline] pub fn data_mut(&mut self) -> &mut [[f32; 3]] { &mut self.data } #[must_use] - #[inline(always)] + #[inline] pub fn into_data(self) -> Vec<[f32; 3]> { self.data } #[must_use] - #[inline(always)] + #[inline] pub const fn width(&self) -> usize { self.width } #[must_use] - #[inline(always)] + #[inline] pub const fn height(&self) -> usize { self.height } diff --git a/src/linear_rgb.rs b/src/linear_rgb.rs index b22a18a..beebcf2 100644 --- a/src/linear_rgb.rs +++ b/src/linear_rgb.rs @@ -39,31 +39,31 @@ impl LinearRgb { } #[must_use] - #[inline(always)] + #[inline] pub fn data(&self) -> &[[f32; 3]] { &self.data } #[must_use] - #[inline(always)] + #[inline] pub fn data_mut(&mut self) -> &mut [[f32; 3]] { &mut self.data } #[must_use] - #[inline(always)] + #[inline] pub fn into_data(self) -> Vec<[f32; 3]> { self.data } #[must_use] - #[inline(always)] + #[inline] pub const fn width(&self) -> usize { self.width } #[must_use] - #[inline(always)] + #[inline] pub const fn height(&self) -> usize { self.height } diff --git a/src/math.rs b/src/math.rs index f62e78f..76cbda9 100644 --- a/src/math.rs +++ b/src/math.rs @@ -130,32 +130,32 @@ fn log2(x: f32) -> f32 { polynomial + exp } -#[inline(always)] +#[inline] fn poly5(x: f32, c0: f32, c1: f32, c2: f32, c3: f32, c4: f32, c5: f32) -> f32 { multiply_add(x, poly4(x, c1, c2, c3, c4, c5), c0) } -#[inline(always)] +#[inline] fn poly4(x: f32, c0: f32, c1: f32, c2: f32, c3: f32, c4: f32) -> f32 { multiply_add(x, poly3(x, c1, c2, c3, c4), c0) } -#[inline(always)] +#[inline] fn poly3(x: f32, c0: f32, c1: f32, c2: f32, c3: f32) -> f32 { multiply_add(x, poly2(x, c1, c2, c3), c0) } -#[inline(always)] +#[inline] fn poly2(x: f32, c0: f32, c1: f32, c2: f32) -> f32 { multiply_add(x, poly1(x, c1, c2), c0) } -#[inline(always)] +#[inline] fn poly1(x: f32, c0: f32, c1: f32) -> f32 { multiply_add(x, poly0(x, c1), c0) } -#[inline(always)] +#[inline] const fn poly0(_x: f32, c0: f32) -> f32 { c0 } diff --git a/src/rgb.rs b/src/rgb.rs index b0d364b..37a6704 100644 --- a/src/rgb.rs +++ b/src/rgb.rs @@ -61,43 +61,43 @@ impl Rgb { } #[must_use] - #[inline(always)] + #[inline] pub fn data(&self) -> &[[f32; 3]] { &self.data } #[must_use] - #[inline(always)] + #[inline] pub fn data_mut(&mut self) -> &mut [[f32; 3]] { &mut self.data } #[must_use] - #[inline(always)] + #[inline] pub fn into_data(self) -> Vec<[f32; 3]> { self.data } #[must_use] - #[inline(always)] + #[inline] pub const fn width(&self) -> usize { self.width } #[must_use] - #[inline(always)] + #[inline] pub const fn height(&self) -> usize { self.height } #[must_use] - #[inline(always)] + #[inline] pub const fn transfer(&self) -> TransferCharacteristic { self.transfer } #[must_use] - #[inline(always)] + #[inline] pub const fn primaries(&self) -> ColorPrimaries { self.primaries } diff --git a/src/xyb.rs b/src/xyb.rs index 152ed26..182e504 100644 --- a/src/xyb.rs +++ b/src/xyb.rs @@ -35,31 +35,31 @@ impl Xyb { } #[must_use] - #[inline(always)] + #[inline] pub fn data(&self) -> &[[f32; 3]] { &self.data } #[must_use] - #[inline(always)] + #[inline] pub fn data_mut(&mut self) -> &mut [[f32; 3]] { &mut self.data } #[must_use] - #[inline(always)] + #[inline] pub fn into_data(self) -> Vec<[f32; 3]> { self.data } #[must_use] - #[inline(always)] + #[inline] pub const fn width(&self) -> usize { self.width } #[must_use] - #[inline(always)] + #[inline] pub const fn height(&self) -> usize { self.height } diff --git a/src/yuv.rs b/src/yuv.rs index 7795628..fea6256 100644 --- a/src/yuv.rs +++ b/src/yuv.rs @@ -121,25 +121,25 @@ impl Yuv { } #[must_use] - #[inline(always)] + #[inline] pub const fn data(&self) -> &[Plane] { &self.data.planes } #[must_use] - #[inline(always)] + #[inline] pub const fn width(&self) -> usize { self.data.planes[0].cfg.width } #[must_use] - #[inline(always)] + #[inline] pub const fn height(&self) -> usize { self.data.planes[0].cfg.height } #[must_use] - #[inline(always)] + #[inline] pub const fn config(&self) -> YuvConfig { self.config }