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

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> /// </returns>
public static bool IsPrime(this byte value) public static bool IsPrime(this byte value)
{ {
return ((int)value).IsPrime(); return ((short)value).IsPrime();
} }
/// <summary> /// <summary>

View File

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