diff --git a/X10D/src/Math/ByteExtensions.cs b/X10D/src/Math/ByteExtensions.cs index 310c4e4..ca68dd6 100644 --- a/X10D/src/Math/ByteExtensions.cs +++ b/X10D/src/Math/ByteExtensions.cs @@ -73,7 +73,7 @@ public static class ByteExtensions #endif public static bool IsEven(this byte value) { - return value % 2 == 0; + return (value & 1) == 0; } /// diff --git a/X10D/src/Math/Int64Extensions.cs b/X10D/src/Math/Int64Extensions.cs index 01f10fa..fdb920b 100644 --- a/X10D/src/Math/Int64Extensions.cs +++ b/X10D/src/Math/Int64Extensions.cs @@ -121,7 +121,7 @@ public static class Int64Extensions case <= 3: return true; } - if (value % 2 == 0 || value % 3 == 0) + if ((value & 1) == 0 || value % 3 == 0) { return false; } diff --git a/X10D/src/Math/SByteExtensions.cs b/X10D/src/Math/SByteExtensions.cs index 07252ef..f77d56d 100644 --- a/X10D/src/Math/SByteExtensions.cs +++ b/X10D/src/Math/SByteExtensions.cs @@ -79,7 +79,7 @@ public static class SByteExtensions #endif public static bool IsEven(this sbyte value) { - return value % 2 == 0; + return (value & 1) == 0; } /// diff --git a/X10D/src/Math/UInt64Extensions.cs b/X10D/src/Math/UInt64Extensions.cs index f081236..9d2efbc 100644 --- a/X10D/src/Math/UInt64Extensions.cs +++ b/X10D/src/Math/UInt64Extensions.cs @@ -1,4 +1,4 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; namespace X10D.Math; @@ -97,7 +97,7 @@ public static class UInt64Extensions case <= 3: return true; } - if (value % 2 == 0 || value % 3 == 0) + if ((value & 1) == 0 || value % 3 == 0) { return false; }