Browse Source

Simplify

pull/3153/head
winscripter 1 day ago
parent
commit
4ec9b957a2
  1. 11
      src/ImageSharp/Formats/Jxl/IO/JxlAnsHelper.cs

11
src/ImageSharp/Formats/Jxl/IO/JxlAnsHelper.cs

@ -11,16 +11,7 @@ internal static class JxlAnsHelper
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetPopulationCountPrecision(int logCount, int shift) public static int GetPopulationCountPrecision(int logCount, int shift)
{ => Math.Max(0, Math.Min(logCount, shift - ((JxlAnsConstants.AnsLogTableSize - logCount) >> 1)));
int r = Math.Min(logCount, shift - ((JxlAnsConstants.AnsLogTableSize - logCount) >> 1));
if (r < 0)
{
return 0;
}
return r;
}
// NOTE: The result may potentially be large, so prefer using a memory allocator // NOTE: The result may potentially be large, so prefer using a memory allocator
public static IMemoryOwner<int> CreateFlatHistogram(Configuration configuration, int length, int totalCount) public static IMemoryOwner<int> CreateFlatHistogram(Configuration configuration, int length, int totalCount)

Loading…
Cancel
Save