1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:45:41 +00:00

Delegate byte prime check to int

This commit is contained in:
Oliver Booth 2021-07-20 00:50:10 +01:00
parent 1cc2300e83
commit 6722c0185e
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4

View File

@ -1,4 +1,4 @@
namespace X10D
namespace X10D
{
/// <summary>
/// Extension methods for <see cref="byte" />.
@ -50,64 +50,7 @@
/// </returns>
public static bool IsPrime(this byte value)
{
return value switch
{
2 => true,
3 => true,
5 => true,
7 => true,
11 => true,
13 => true,
17 => true,
19 => true,
23 => true,
29 => true,
31 => true,
37 => true,
41 => true,
43 => true,
47 => true,
53 => true,
59 => true,
61 => true,
67 => true,
71 => true,
73 => true,
79 => true,
83 => true,
89 => true,
97 => true,
101 => true,
103 => true,
107 => true,
109 => true,
113 => true,
127 => true,
131 => true,
137 => true,
139 => true,
149 => true,
151 => true,
157 => true,
163 => true,
167 => true,
173 => true,
179 => true,
181 => true,
191 => true,
193 => true,
197 => true,
199 => true,
211 => true,
223 => true,
227 => true,
229 => true,
233 => true,
239 => true,
241 => true,
251 => true,
_ => false
};
return ((int)value).IsPrime();
}
/// <summary>