From e70c1c6bb006a1471784bdbec3160019c3cadcdd Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 24 Feb 2019 11:50:49 +0100 Subject: [PATCH] Removed equals-check in percentage->byte conversion --- RGB.NET.Core/Extensions/MathExtensions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RGB.NET.Core/Extensions/MathExtensions.cs b/RGB.NET.Core/Extensions/MathExtensions.cs index 415a53c..397d297 100644 --- a/RGB.NET.Core/Extensions/MathExtensions.cs +++ b/RGB.NET.Core/Extensions/MathExtensions.cs @@ -68,16 +68,16 @@ namespace RGB.NET.Core return value; } - + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte GetByteValueFromPercentage(this double percentage) { if (double.IsNaN(percentage)) return 0; percentage = percentage.Clamp(0, 1.0); - return (byte)(percentage.Equals(1.0) ? 255 : percentage * 256.0); + return (byte)(percentage >= 1.0 ? 255 : percentage * 256.0); } - + #endregion } }