mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 01:28:48 +00:00
[ci skip] Condense switch statement for IsPrime
This commit is contained in:
parent
9d6dbaaa23
commit
941f3acc56
@ -1,4 +1,4 @@
|
|||||||
using System.Diagnostics.Contracts;
|
using System.Diagnostics.Contracts;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace X10D.Math;
|
namespace X10D.Math;
|
||||||
@ -117,9 +117,8 @@ public static class Int64Extensions
|
|||||||
{
|
{
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case < 2: return false;
|
case <= 1: return false;
|
||||||
case 2:
|
case <= 3: return true;
|
||||||
case 3: return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value % 2 == 0 || value % 3 == 0)
|
if (value % 2 == 0 || value % 3 == 0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Diagnostics.Contracts;
|
using System.Diagnostics.Contracts;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace X10D.Math;
|
namespace X10D.Math;
|
||||||
@ -93,9 +93,8 @@ public static class UInt64Extensions
|
|||||||
{
|
{
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case < 2: return false;
|
case <= 1: return false;
|
||||||
case 2:
|
case <= 3: return true;
|
||||||
case 3: return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value % 2 == 0 || value % 3 == 0)
|
if (value % 2 == 0 || value % 3 == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user