Delegate (s)byte.IsPrime to short.isPrime

This commit is contained in:
Oliver Booth 2021-07-20 14:26:23 +01:00
parent f20aa3dbd4
commit f0e3b65604
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4
2 changed files with 3 additions and 37 deletions

View File

@ -50,7 +50,7 @@
/// </returns>
public static bool IsPrime(this byte value)
{
return ((int)value).IsPrime();
return ((short)value).IsPrime();
}
/// <summary>

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace X10D
{
@ -43,41 +43,7 @@ namespace X10D
/// </returns>
public static bool IsPrime(this sbyte 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,
_ => false
};
return ((short)value).IsPrime();
}
/// <summary>