From e6ed4baefd76de2e4ea479914dde49c09992a709 Mon Sep 17 00:00:00 2001 From: winscripter <142818255+winscripter@users.noreply.github.com> Date: Mon, 31 Aug 2026 20:46:24 +0400 Subject: [PATCH] Use Math.Clamp --- src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs b/src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs index 54a41f99a..3b7500fd0 100644 --- a/src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs +++ b/src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs @@ -261,15 +261,7 @@ internal sealed class JxlQuantizer const int quantFieldTarget = 5; float scale = GlobalScaleDenominator * (quantMedian - quantMedianAbsd) / quantFieldTarget; - if (scale < 1) - { - scale = 1; - } - - if (scale > (1 << 15)) - { - scale = 1 << 15; - } + scale = Math.Clamp(scale, 1, 1 << 15); int newGlobalScale = (int)scale; int scaledQuantDc = (int)(quantDc * GlobalScaleNumerator * 1.6f);