From 72dbaa72ba1395e1214248f568fb3e7ce044be7c Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Thu, 14 Nov 2024 16:29:15 +0000 Subject: [PATCH] refactor!: remove redundant Sign overloads --- CHANGELOG.md | 1 + X10D/src/Math/DecimalExtensions.cs | 34 ----------------------------- X10D/src/Math/DoubleExtensions.cs | 35 ------------------------------ X10D/src/Math/Int16Extensions.cs | 34 ----------------------------- X10D/src/Math/Int32Extensions.cs | 34 ----------------------------- X10D/src/Math/Int64Extensions.cs | 34 ----------------------------- X10D/src/Math/SingleExtensions.cs | 34 ----------------------------- 7 files changed, 1 insertion(+), 205 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 851973c..ff8f8f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - X10D: Removed `IEnumerable.LowestCommonMultiple` for all integer types in favour of generic math. - X10D: Removed `IEnumerable.Product` for all integer types in favour of generic math. - X10D: Removed `IEnumerable.RangeTo` for all integer types in favour of generic math. +- X10D: Removed `T.Sign` for all numeric types in favour of generic math. ### Removed diff --git a/X10D/src/Math/DecimalExtensions.cs b/X10D/src/Math/DecimalExtensions.cs index 1aa678d..56bddc3 100644 --- a/X10D/src/Math/DecimalExtensions.cs +++ b/X10D/src/Math/DecimalExtensions.cs @@ -90,40 +90,6 @@ public static class DecimalExtensions return System.Math.Clamp(value, 0.0m, 1.0m); } - /// - /// Returns an integer that indicates the sign of this decimal number. - /// - /// 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(CompilerResources.MaxOptimization)] - public static int Sign(this decimal value) - { - return System.Math.Sign(value); - } - /// /// Returns the square root of this decimal number. /// diff --git a/X10D/src/Math/DoubleExtensions.cs b/X10D/src/Math/DoubleExtensions.cs index 51a7b7a..06abc82 100644 --- a/X10D/src/Math/DoubleExtensions.cs +++ b/X10D/src/Math/DoubleExtensions.cs @@ -300,41 +300,6 @@ public static class DoubleExtensions return System.Math.Sinh(value); } - /// - /// Returns an integer that indicates the sign of this double-precision floating-point number. - /// - /// 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. - /// - /// - /// - /// is equal to . - [Pure] - [MethodImpl(CompilerResources.MaxOptimization)] - public static int Sign(this double value) - { - return System.Math.Sign(value); - } - /// /// Returns the square root of this double-precision floating-point number. /// diff --git a/X10D/src/Math/Int16Extensions.cs b/X10D/src/Math/Int16Extensions.cs index d2f0707..71594a5 100644 --- a/X10D/src/Math/Int16Extensions.cs +++ b/X10D/src/Math/Int16Extensions.cs @@ -38,40 +38,6 @@ public static class Int16Extensions return ((long)value).MultiplicativePersistence(); } - /// - /// Returns an integer that indicates the sign of this 16-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(CompilerResources.MaxOptimization)] - public static int Sign(this short value) - { - return System.Math.Sign(value); - } - /// /// Wraps the current 16-bit signed integer between a low and a high value. /// diff --git a/X10D/src/Math/Int32Extensions.cs b/X10D/src/Math/Int32Extensions.cs index 8f235e1..b4fefe4 100644 --- a/X10D/src/Math/Int32Extensions.cs +++ b/X10D/src/Math/Int32Extensions.cs @@ -38,40 +38,6 @@ public static class Int32Extensions return ((long)value).MultiplicativePersistence(); } - /// - /// 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(CompilerResources.MaxOptimization)] - public static int Sign(this int value) - { - return System.Math.Sign(value); - } - /// /// Wraps the current 32-bit signed integer between a low and a high value. /// diff --git a/X10D/src/Math/Int64Extensions.cs b/X10D/src/Math/Int64Extensions.cs index dd0d398..e06907e 100644 --- a/X10D/src/Math/Int64Extensions.cs +++ b/X10D/src/Math/Int64Extensions.cs @@ -88,40 +88,6 @@ public static class Int64Extensions return persistence; } - /// - /// Returns an integer that indicates the sign of this 64-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(CompilerResources.MaxOptimization)] - public static int Sign(this long value) - { - return System.Math.Sign(value); - } - /// /// Wraps the current 64-bit signed integer between a low and a high value. /// diff --git a/X10D/src/Math/SingleExtensions.cs b/X10D/src/Math/SingleExtensions.cs index 9e70592..fa90dbf 100644 --- a/X10D/src/Math/SingleExtensions.cs +++ b/X10D/src/Math/SingleExtensions.cs @@ -268,40 +268,6 @@ public static class SingleExtensions return System.Math.Clamp(value, 0.0f, 1.0f); } - /// - /// Returns an integer that indicates the sign of this single-precision floating-point number. - /// - /// 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(CompilerResources.MaxOptimization)] - public static int Sign(this float value) - { - return MathF.Sign(value); - } - /// /// Returns the square root of this single-precision floating-point number. ///