Browse Source

Use Math.Clamp(input, 0, 255)

Co-authored-by: Günther Foidl <gue@korporal.at>
pull/1731/head
Brian Popow 5 years ago
committed by GitHub
parent
commit
59b470f4da
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs

2
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

Loading…
Cancel
Save