BitContradiction improvements - 0.043s, p=138000001+

This commit is contained in:
mlemanczyk committed 2026-01-17 15:37:43 +01:00
1 parent e97ea151e1
commit 41e421e1eb
9 files changed
+5227 -1971

No files matched your search

@@ -7,7 +7,7 @@ namespace PerfectNumbers.Core;
internal struct MersenneDivisorResidueStepper(ulong prime, in GpuUInt128 step, in GpuUInt128 firstDivisor)
{
private const ushort DecimalMaskWhenLastIsSeven = (1 << 3) | (1 << 7) | (1 << 9);
private const ushort DecimalMaskOtherwise = (1 << 1) | (1 << 3) | (1 << 9);
private const ushort DecimalMaskOtherwise = (1 << 1) | (1 << 3) | (1 << 7) | (1 << 9);
private readonly ushort decimalMask = (prime & 3UL) == 3UL ? DecimalMaskWhenLastIsSeven : DecimalMaskOtherwise;
private readonly byte step10 = ComputeModulo(step, 10, multiplier: 6);
@@ -92,7 +92,7 @@ internal struct MersenneDivisorResidueStepper(ulong prime, in GpuUInt128 step, i
internal struct MersenneDivisorResidueStepperDescending(ulong prime, in GpuUInt128 step, in GpuUInt128 firstDivisor)
{
private const ushort DecimalMaskWhenLastIsSeven = (1 << 3) | (1 << 7) | (1 << 9);
private const ushort DecimalMaskOtherwise = (1 << 1) | (1 << 3) | (1 << 9);
private const ushort DecimalMaskOtherwise = (1 << 1) | (1 << 3) | (1 << 7) | (1 << 9);
private readonly ushort decimalMask = (prime & 3UL) == 3UL ? DecimalMaskWhenLastIsSeven : DecimalMaskOtherwise;
private readonly byte step10 = ComputeModulo(step, 10, multiplier: 6);