diff --git a/X10D/src/Int16Extensions/Int16Extensions.cs b/X10D/src/Int16Extensions/Int16Extensions.cs
index 16e4dab..371c883 100644
--- a/X10D/src/Int16Extensions/Int16Extensions.cs
+++ b/X10D/src/Int16Extensions/Int16Extensions.cs
@@ -1,7 +1,4 @@
-using System.Diagnostics.Contracts;
-using System.Net;
-using System.Runtime.CompilerServices;
-using X10D.Math;
+using System.Net;
namespace X10D;
diff --git a/X10D/src/Int32Extensions/Int32Extensions.cs b/X10D/src/Int32Extensions/Int32Extensions.cs
index 36ef219..41013b2 100644
--- a/X10D/src/Int32Extensions/Int32Extensions.cs
+++ b/X10D/src/Int32Extensions/Int32Extensions.cs
@@ -1,6 +1,4 @@
-using System.Diagnostics.Contracts;
-using System.Net;
-using System.Runtime.CompilerServices;
+using System.Net;
using X10D.Math;
namespace X10D;
@@ -82,40 +80,6 @@ public static class Int32Extensions
return BitConverter.GetBytes(value);
}
- ///
- /// Returns an integer that indicates the sign of this 32-bit signed integer.
- ///
- /// A signed number.
- ///
- /// A number that indicates the sign of , as shown in the following table.
- ///
- ///
- ///
- /// Return value
- /// Meaning
- ///
- ///
- /// -
- /// -1
- /// is less than zero.
- ///
- /// -
- /// 0
- /// is equal to zero.
- ///
- /// -
- /// 1
- /// is greater than zero.
- ///
- ///
- ///
- [Pure]
- [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
- public static int Sign(this int value)
- {
- return System.Math.Sign(value);
- }
-
///
/// Returns an enumerable collection of 32-bit signed integers that range from the current value to a specified value.
///
diff --git a/X10D/src/Math/Int32Extensions.cs b/X10D/src/Math/Int32Extensions.cs
index 2e830e7..2a8c8fa 100644
--- a/X10D/src/Math/Int32Extensions.cs
+++ b/X10D/src/Math/Int32Extensions.cs
@@ -215,4 +215,38 @@ public static class Int32Extensions
int r = dividend % divisor;
return r < 0 ? r + divisor : r;
}
+
+ ///
+ /// Returns an integer that indicates the sign of this 32-bit signed integer.
+ ///
+ /// A signed number.
+ ///
+ /// A number that indicates the sign of , as shown in the following table.
+ ///
+ ///
+ ///
+ /// Return value
+ /// Meaning
+ ///
+ ///
+ /// -
+ /// -1
+ /// is less than zero.
+ ///
+ /// -
+ /// 0
+ /// is equal to zero.
+ ///
+ /// -
+ /// 1
+ /// is greater than zero.
+ ///
+ ///
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static int Sign(this int value)
+ {
+ return System.Math.Sign(value);
+ }
}
diff --git a/X10D/src/Math/UInt16Extensions.cs b/X10D/src/Math/UInt16Extensions.cs
index 1b64593..05e8d54 100644
--- a/X10D/src/Math/UInt16Extensions.cs
+++ b/X10D/src/Math/UInt16Extensions.cs
@@ -46,4 +46,34 @@ public static class UInt16Extensions
return result;
}
+
+ ///
+ /// Returns a value indicating whether the current value is evenly divisible by 2.
+ ///
+ /// The value whose parity to check.
+ ///
+ /// if is evenly divisible by 2, or
+ /// otherwise.
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static bool IsEven(this ushort value)
+ {
+ return (value & 1) == 0;
+ }
+
+ ///
+ /// Returns a value indicating whether the current value is not evenly divisible by 2.
+ ///
+ /// The value whose parity to check.
+ ///
+ /// if is not evenly divisible by 2, or
+ /// otherwise.
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static bool IsOdd(this ushort value)
+ {
+ return !value.IsEven();
+ }
}
diff --git a/X10D/src/Math/UInt32Extensions.cs b/X10D/src/Math/UInt32Extensions.cs
index f041474..288cdad 100644
--- a/X10D/src/Math/UInt32Extensions.cs
+++ b/X10D/src/Math/UInt32Extensions.cs
@@ -46,4 +46,34 @@ public static class UInt32Extensions
return result;
}
+
+ ///
+ /// Returns a value indicating whether the current value is evenly divisible by 2.
+ ///
+ /// The value whose parity to check.
+ ///
+ /// if is evenly divisible by 2, or
+ /// otherwise.
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static bool IsEven(this uint value)
+ {
+ return (value & 1) == 0;
+ }
+
+ ///
+ /// Returns a value indicating whether the current value is not evenly divisible by 2.
+ ///
+ /// The value whose parity to check.
+ ///
+ /// if is not evenly divisible by 2, or
+ /// otherwise.
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static bool IsOdd(this uint value)
+ {
+ return !value.IsEven();
+ }
}
diff --git a/X10D/src/Math/UInt64Extensions.cs b/X10D/src/Math/UInt64Extensions.cs
index 3f898fa..2753a02 100644
--- a/X10D/src/Math/UInt64Extensions.cs
+++ b/X10D/src/Math/UInt64Extensions.cs
@@ -46,4 +46,34 @@ public static class UInt64Extensions
return result;
}
+
+ ///
+ /// Returns a value indicating whether the current value is evenly divisible by 2.
+ ///
+ /// The value whose parity to check.
+ ///
+ /// if is evenly divisible by 2, or
+ /// otherwise.
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static bool IsEven(this ulong value)
+ {
+ return (value & 1) == 0;
+ }
+
+ ///
+ /// Returns a value indicating whether the current value is not evenly divisible by 2.
+ ///
+ /// The value whose parity to check.
+ ///
+ /// if is not evenly divisible by 2, or
+ /// otherwise.
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static bool IsOdd(this ulong value)
+ {
+ return !value.IsEven();
+ }
}