From 0d8d438d6be5feac06dfdd9ac1dc1e626f6bb7ff Mon Sep 17 00:00:00 2001 From: MrGadget1024 <9826063+MrGadget1024@users.noreply.github.com> Date: Sun, 12 Mar 2023 09:33:12 -0400 Subject: [PATCH] Simplified --- .../Core/SnapshotInterpolation/SnapshotInterpolation.cs | 8 +++++--- Assets/Mirror/Core/Tools/Extensions.cs | 8 -------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs b/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs index 36387608d..421a44f56 100644 --- a/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs +++ b/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs @@ -130,10 +130,12 @@ public static double TimelineClamp( // outside of the area, we clamp. double lowerBound = targetTime - bufferTime; double upperBound = targetTime + bufferTime; -#if !UNITY_2021_OR_NEWER - return Extensions.Clamp(localTimeline, lowerBound, upperBound); -#else +#if UNITY_2021_OR_NEWER return Math.Clamp(localTimeline, lowerBound, upperBound); +#else + if (localTimeline.CompareTo(lowerBound) < 0) return lowerBound; + else if (localTimeline.CompareTo(upperBound) > 0) return upperBound; + else return localTimeline; #endif } diff --git a/Assets/Mirror/Core/Tools/Extensions.cs b/Assets/Mirror/Core/Tools/Extensions.cs index ca394e8bb..02407e09f 100644 --- a/Assets/Mirror/Core/Tools/Extensions.cs +++ b/Assets/Mirror/Core/Tools/Extensions.cs @@ -59,14 +59,6 @@ public static bool TryDequeue(this Queue source, out T element) element = default; return false; } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static T Clamp(this T val, T min, T max) where T : IComparable - { - if (val.CompareTo(min) < 0) return min; - else if (val.CompareTo(max) > 0) return max; - else return val; - } #endif } }