diff --git a/src/ImageSharp/Common/Extensions/ComparableExtensions.cs b/src/ImageSharp/Common/Extensions/ComparableExtensions.cs index 6b0e34e79..d46330102 100644 --- a/src/ImageSharp/Common/Extensions/ComparableExtensions.cs +++ b/src/ImageSharp/Common/Extensions/ComparableExtensions.cs @@ -6,6 +6,7 @@ namespace ImageSharp { using System; + using System.Runtime.CompilerServices; /// /// Extension methods for classes that implement . @@ -21,6 +22,7 @@ namespace ImageSharp /// /// The representing the clamped value. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte Clamp(this byte value, byte min, byte max) { // Order is important here as someone might set min to higher than max. @@ -46,6 +48,7 @@ namespace ImageSharp /// /// The representing the clamped value. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint Clamp(this uint value, uint min, uint max) { if (value >= max) @@ -70,6 +73,7 @@ namespace ImageSharp /// /// The representing the clamped value. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Clamp(this int value, int min, int max) { if (value >= max) @@ -94,6 +98,7 @@ namespace ImageSharp /// /// The representing the clamped value. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static float Clamp(this float value, float min, float max) { if (value >= max) @@ -118,6 +123,7 @@ namespace ImageSharp /// /// The representing the clamped value. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double Clamp(this double value, double min, double max) { if (value >= max) @@ -172,6 +178,7 @@ namespace ImageSharp /// The first reference. /// The second reference. /// The type of object. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Swap(ref T first, ref T second) { T temp = second;