From 59b470f4daf85e1554eaf1ffb2faea7b7b59811a Mon Sep 17 00:00:00 2001 From: Brian Popow <38701097+brianpopow@users.noreply.github.com> Date: Mon, 9 Aug 2021 17:05:01 +0200 Subject: [PATCH] Use Math.Clamp(input, 0, 255) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Günther Foidl --- .../Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs index 3e28e30bc4..aa64a6e32e 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs @@ -68,7 +68,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation private static byte RoundAndClampTo8Bit(float value) { int input = (int)MathF.Round(value); - return (byte)Math.Min(Math.Max(input, 0), 255); + return (byte)Math.Clamp(input, 0, 255); } private readonly struct CodingRangeExpander