Stack overflow fixed

This commit is contained in:
Marek Lemańczyk committed 2025-09-12 10:59:58 +02:00
1 parent 0535ad2b7b
commit dd6d9a71cf
1 file changed
+2 -2
@@ -15,7 +15,7 @@ public sealed class MersenneNumberDivisorGpuTester
public static void BuildDivisorCandidates() public static void BuildDivisorCandidates()
{ {
uint[] snapshot = MersenneDivisorCycles.Shared.ExportSmallCyclesSnapshot(); uint[] snapshot = MersenneDivisorCycles.Shared.ExportSmallCyclesSnapshot();
Span<(ulong divisor, uint cycle)> list = stackalloc (ulong divisor, uint cycle)[snapshot.Length / 2]; (ulong divisor, uint cycle)[] list = new (ulong divisor, uint cycle)[snapshot.Length / 2];
uint cycle; uint cycle;
int count = 0, i, snapshotLength = snapshot.Length; int count = 0, i, snapshotLength = snapshot.Length;
for (i = 3; i < snapshotLength; i += 2) for (i = 3; i < snapshotLength; i += 2)
@@ -65,7 +65,7 @@ public sealed class MersenneNumberDivisorGpuTester
var candidates = _divisorCandidates!; var candidates = _divisorCandidates!;
int k, len = candidates.Length; int k, len = candidates.Length;
uint cycle; uint cycle;
// k is simple iterator here // k is simple iterator here
for (k = 0; k < len; k++) for (k = 0; k < len; k++)
{ {