Simplify exception guards in CPU remainder paths

This commit is contained in:
Marek Lemańczyk committed 2025-10-21 20:52:14 +02:00
1 parent 6adf78faf6
commit 7baf3b619f
2 files changed
+2 -49

No files matched your search

+1 -17
View File
@@ -501,18 +501,6 @@ public class MersenneDivisorCycles
if (multiplicity > HeapMultiplicityCapacity)
{
if (heapCandidateArray is not null)
{
ThreadStaticPools.UlongPool.Return(heapCandidateArray);
}
if (heapEvaluationArray is not null)
{
ThreadStaticPools.BoolPool.Return(heapEvaluationArray);
}
ThreadStaticPools.ReturnExponentStepper(stepper);
ThreadStaticPools.UlongPool.Return(primes);
throw new InvalidOperationException($"Factor multiplicity {multiplicity} exceeds the supported limit of {HeapMultiplicityCapacity}.");
}
@@ -528,11 +516,7 @@ public class MersenneDivisorCycles
if (heapCandidateArray is not null)
{
ThreadStaticPools.UlongPool.Return(heapCandidateArray);
}
if (heapEvaluationArray is not null)
{
ThreadStaticPools.BoolPool.Return(heapEvaluationArray);
ThreadStaticPools.BoolPool.Return(heapEvaluationArray!);
}
return order;