Small optimizations
This commit is contained in:
1 parent
df71823c8f
commit
40dff45a81
1 file changed
+13
-41
@@ -876,54 +876,26 @@ internal static partial class PrimeOrderCalculator
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly struct CandidateKey
|
private readonly struct CandidateKey(int primary, long secondary, long tertiary)
|
||||||
{
|
{
|
||||||
public CandidateKey(int primary, long secondary, long tertiary)
|
public readonly int Primary = primary;
|
||||||
{
|
public readonly long Secondary = secondary;
|
||||||
Primary = primary;
|
public readonly long Tertiary = tertiary;
|
||||||
Secondary = secondary;
|
|
||||||
Tertiary = tertiary;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Primary { get; }
|
|
||||||
|
|
||||||
public long Secondary { get; }
|
|
||||||
|
|
||||||
public long Tertiary { get; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly struct FactorEntry
|
private readonly struct FactorEntry(ulong value, int exponent)
|
||||||
{
|
{
|
||||||
public FactorEntry(ulong value, int exponent)
|
public readonly ulong Value = value;
|
||||||
{
|
public readonly int Exponent = exponent;
|
||||||
Value = value;
|
|
||||||
Exponent = exponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong Value { get; }
|
|
||||||
|
|
||||||
public int Exponent { get; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly struct PartialFactorResult
|
private readonly struct PartialFactorResult(FactorEntry[]? factors, ulong cofactor, bool fullyFactored, int count)
|
||||||
{
|
{
|
||||||
public PartialFactorResult(FactorEntry[]? factors, ulong cofactor, bool fullyFactored, int count)
|
public readonly FactorEntry[]? Factors = factors;
|
||||||
{
|
public readonly ulong Cofactor = cofactor;
|
||||||
Factors = factors;
|
public readonly bool FullyFactored = fullyFactored;
|
||||||
Cofactor = cofactor;
|
public readonly int Count = count;
|
||||||
FullyFactored = fullyFactored;
|
public readonly static PartialFactorResult Empty = new(null, 1UL, true, 0);
|
||||||
Count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FactorEntry[]? Factors { get; }
|
|
||||||
|
|
||||||
public ulong Cofactor { get; }
|
|
||||||
|
|
||||||
public bool FullyFactored { get; }
|
|
||||||
|
|
||||||
public int Count { get; }
|
|
||||||
|
|
||||||
public static PartialFactorResult Empty => new(null, 1UL, true, 0);
|
|
||||||
|
|
||||||
public PartialFactorResult WithAdditionalPrime(ulong prime)
|
public PartialFactorResult WithAdditionalPrime(ulong prime)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user