Skip to content

Commit

Permalink
refactor: less #[inline(always)]
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezyLemon committed Sep 23, 2024
1 parent c0d398d commit 56d9f9c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 32 deletions.
5 changes: 0 additions & 5 deletions src/hsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,26 @@ impl Hsl {
}

#[must_use]
#[inline(always)]
pub fn data(&self) -> &[[f32; 3]] {
&self.data
}

#[must_use]
#[inline(always)]
pub fn data_mut(&mut self) -> &mut [[f32; 3]] {
&mut self.data
}

#[must_use]
#[inline(always)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}

#[must_use]
#[inline(always)]
pub const fn width(&self) -> usize {
self.width
}

#[must_use]
#[inline(always)]
pub const fn height(&self) -> usize {
self.height
}
Expand Down
5 changes: 0 additions & 5 deletions src/linear_rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,26 @@ impl LinearRgb {
}

#[must_use]
#[inline(always)]
pub fn data(&self) -> &[[f32; 3]] {
&self.data
}

#[must_use]
#[inline(always)]
pub fn data_mut(&mut self) -> &mut [[f32; 3]] {
&mut self.data
}

#[must_use]
#[inline(always)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}

#[must_use]
#[inline(always)]
pub const fn width(&self) -> usize {
self.width
}

#[must_use]
#[inline(always)]
pub const fn height(&self) -> usize {
self.height
}
Expand Down
12 changes: 6 additions & 6 deletions src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 0 additions & 7 deletions src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,36 @@ impl Rgb {
}

#[must_use]
#[inline(always)]
pub fn data(&self) -> &[[f32; 3]] {
&self.data
}

#[must_use]
#[inline(always)]
pub fn data_mut(&mut self) -> &mut [[f32; 3]] {
&mut self.data
}

#[must_use]
#[inline(always)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}

#[must_use]
#[inline(always)]
pub const fn width(&self) -> usize {
self.width
}

#[must_use]
#[inline(always)]
pub const fn height(&self) -> usize {
self.height
}

#[must_use]
#[inline(always)]
pub const fn transfer(&self) -> TransferCharacteristic {
self.transfer
}

#[must_use]
#[inline(always)]
pub const fn primaries(&self) -> ColorPrimaries {
self.primaries
}
Expand Down
5 changes: 0 additions & 5 deletions src/xyb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,26 @@ impl Xyb {
}

#[must_use]
#[inline(always)]
pub fn data(&self) -> &[[f32; 3]] {
&self.data
}

#[must_use]
#[inline(always)]
pub fn data_mut(&mut self) -> &mut [[f32; 3]] {
&mut self.data
}

#[must_use]
#[inline(always)]
pub fn into_data(self) -> Vec<[f32; 3]> {
self.data
}

#[must_use]
#[inline(always)]
pub const fn width(&self) -> usize {
self.width
}

#[must_use]
#[inline(always)]
pub const fn height(&self) -> usize {
self.height
}
Expand Down
4 changes: 0 additions & 4 deletions src/yuv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,21 @@ impl<T: Pixel> Yuv<T> {
}

#[must_use]
#[inline(always)]
pub const fn data(&self) -> &[Plane<T>] {
&self.data.planes
}

#[must_use]
#[inline(always)]
pub const fn width(&self) -> usize {
self.data.planes[0].cfg.width
}

#[must_use]
#[inline(always)]
pub const fn height(&self) -> usize {
self.data.planes[0].cfg.height
}

#[must_use]
#[inline(always)]
pub const fn config(&self) -> YuvConfig {
self.config
}
Expand Down

0 comments on commit 56d9f9c

Please sign in to comment.