mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
perf: remove redundant 6k ± 1 check in IsPrime
No integers >3 satisfy the condition of being odd AND not being a multiple of 3 (as checked above) AND not being in the form 6k ± 1. This condition never evaluates to true, and so the return is never reached and was preventing this method from hitting 100% code coverage.
This commit is contained in:
parent
c8ccb1deb8
commit
e70781ef0f
@ -148,11 +148,6 @@ public static class Int64Extensions
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((value + 1) % 6 != 0 && (value - 1) % 6 != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var iterator = 5L; iterator * iterator <= value; iterator += 6)
|
||||
{
|
||||
if (value % iterator == 0 || value % (iterator + 2) == 0)
|
||||
|
@ -125,11 +125,6 @@ public static class UInt64Extensions
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((value + 1) % 6 != 0 && (value - 1) % 6 != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var iterator = 5UL; iterator * iterator <= value; iterator += 6)
|
||||
{
|
||||
if (value % iterator == 0 || value % (iterator + 2) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user