Skip to content

Commit

Permalink
refactor: less #[inline(always)]
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezyLemon authored and shssoichiro committed Sep 24, 2024
1 parent c0d398d commit 9f07a7c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
10 changes: 5 additions & 5 deletions src/hsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions src/linear_rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
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
14 changes: 7 additions & 7 deletions src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions src/xyb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions src/yuv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,25 @@ impl<T: Pixel> Yuv<T> {
}

#[must_use]
#[inline(always)]
#[inline]
pub const fn data(&self) -> &[Plane<T>] {
&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
}
Expand Down

0 comments on commit 9f07a7c

Please sign in to comment.