From f0e3b65604fc429acd6002565b5f486efed3c7a2 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 20 Jul 2021 14:26:23 +0100 Subject: [PATCH] Delegate (s)byte.IsPrime to short.isPrime --- X10D/src/ByteExtensions/ByteExtensions.cs | 2 +- X10D/src/ByteExtensions/SByteExtensions.cs | 38 ++-------------------- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/X10D/src/ByteExtensions/ByteExtensions.cs b/X10D/src/ByteExtensions/ByteExtensions.cs index 3556a2e..507f418 100644 --- a/X10D/src/ByteExtensions/ByteExtensions.cs +++ b/X10D/src/ByteExtensions/ByteExtensions.cs @@ -50,7 +50,7 @@ /// public static bool IsPrime(this byte value) { - return ((int)value).IsPrime(); + return ((short)value).IsPrime(); } /// diff --git a/X10D/src/ByteExtensions/SByteExtensions.cs b/X10D/src/ByteExtensions/SByteExtensions.cs index 314dcfd..b7d242f 100644 --- a/X10D/src/ByteExtensions/SByteExtensions.cs +++ b/X10D/src/ByteExtensions/SByteExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace X10D { @@ -43,41 +43,7 @@ namespace X10D /// 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(); } ///