Tiny optimization
This commit is contained in:
1 parent
e525484b48
commit
be7c2b7ae5
1 file changed
+3
-4
@@ -687,13 +687,12 @@ internal static partial class PrimeOrderCalculator
|
|||||||
|
|
||||||
private static bool GetOrComputePrimality(ulong value)
|
private static bool GetOrComputePrimality(ulong value)
|
||||||
{
|
{
|
||||||
if (TryGetCachedPrimality(value, out bool isPrime))
|
if (!TryGetCachedPrimality(value, out bool isPrime))
|
||||||
{
|
{
|
||||||
return isPrime;
|
isPrime = Open.Numeric.Primes.Prime.Numbers.IsPrime(value);
|
||||||
|
CachePrimalityResult(value, isPrime);
|
||||||
}
|
}
|
||||||
|
|
||||||
isPrime = Open.Numeric.Primes.Prime.Numbers.IsPrime(value);
|
|
||||||
CachePrimalityResult(value, isPrime);
|
|
||||||
return isPrime;
|
return isPrime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user