Check for overflow when calculating pow 2

This commit is contained in:
Marek Lemańczyk committed 2025-09-10 19:02:12 +02:00
1 parent 366ac6edb5
commit 60f6952f91
1 file changed
+1 -1
+1 -1
View File
@@ -64,7 +64,7 @@ public static class PrimesGenerator
if (isPrime)
{
primes[primeIndex] = i;
primesPow2[primeIndex] = i * i;
primesPow2[primeIndex] = checked(i * i);
primeIndex++;
}
}