From 561124efcf1bdbf12628c042f2d039cd786ab1d9 Mon Sep 17 00:00:00 2001 From: Valaphee <32491319+valaphee@users.noreply.github.com> Date: Wed, 24 Jan 2024 00:46:39 +0100 Subject: [PATCH] Add inline hints --- crates/bevy_animation/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 90545ecaa465b..a389da5176d32 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -138,6 +138,7 @@ pub enum Interpolation { } impl Interpolation { + #[inline(always)] fn interpolate( self, lerp: f32, @@ -165,6 +166,7 @@ impl Interpolation { } } + #[inline(always)] fn step_size(self) -> usize { match self { Interpolation::Linear | Interpolation::Step => 1, @@ -177,19 +179,22 @@ trait Interpolatable: Sized + Copy + Mul + Add Self; } -impl Interpolatable for Vec3 { +impl Interpolatable for f32 { + #[inline(always)] fn _lerp(self, rhs: Self, t: f32) -> Self { self.lerp(rhs, t) } } -impl Interpolatable for f32 { +impl Interpolatable for Vec3 { + #[inline(always)] fn _lerp(self, rhs: Self, t: f32) -> Self { self.lerp(rhs, t) } } impl Interpolatable for Quat { + #[inline(always)] fn _lerp(self, rhs: Self, t: f32) -> Self { self.slerp(rhs, t) }