From f229cca4278fbcfe97ca165d7a374d4c6b9764d9 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Thu, 20 Jul 2017 22:45:40 -0700 Subject: [PATCH] Deleting the non-shared implementation of `System.Single` and `System.Double`. Signed-off-by: dotnet-bot --- src/mscorlib/shared/System/Double.cs | 41 ++++++++++++++++---------------- src/mscorlib/shared/System/Single.cs | 45 ++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/mscorlib/shared/System/Double.cs b/src/mscorlib/shared/System/Double.cs index ee5ffa0..f12886f 100644 --- a/src/mscorlib/shared/System/Double.cs +++ b/src/mscorlib/shared/System/Double.cs @@ -13,19 +13,19 @@ ===========================================================*/ using System; +using System.Diagnostics.Contracts; using System.Globalization; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; -using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace System { [Serializable] [StructLayout(LayoutKind.Sequential)] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct Double : IComparable, IFormattable, IConvertible - , IComparable, IEquatable + [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public struct Double :IComparable, IConvertible, IFormattable, IComparable, IEquatable { private double m_value; // Do not rename (binary serialization) @@ -42,11 +42,12 @@ namespace System public const double PositiveInfinity = (double)1.0 / (double)(0.0); public const double NaN = (double)0.0 / (double)0.0; - internal static double NegativeZero = BitConverter.Int64BitsToDouble(unchecked((long)0x8000000000000000)); + // We use this explicit definition to avoid the confusion between 0.0 and -0.0. + internal const double NegativeZero = -0.0; /// Determines whether the specified value is finite (zero, subnormal, or normal). [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsFinite(double d) { @@ -56,7 +57,7 @@ namespace System /// Determines whether the specified value is infinite. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsInfinity(double d) { @@ -66,7 +67,7 @@ namespace System /// Determines whether the specified value is NaN. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsNaN(double d) { @@ -76,7 +77,7 @@ namespace System /// Determines whether the specified value is negative. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsNegative(double d) { @@ -86,7 +87,7 @@ namespace System /// Determines whether the specified value is negative infinity. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsNegativeInfinity(double d) { @@ -95,7 +96,7 @@ namespace System /// Determines whether the specified value is normal. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] // This is probably not worth inlining, it has branches and should be rarely called public unsafe static bool IsNormal(double d) { @@ -106,7 +107,7 @@ namespace System /// Determines whether the specified value is positive infinity. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsPositiveInfinity(double d) { @@ -115,7 +116,7 @@ namespace System /// Determines whether the specified value is subnormal. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] // This is probably not worth inlining, it has branches and should be rarely called public unsafe static bool IsSubnormal(double d) { @@ -183,37 +184,37 @@ namespace System return IsNaN(temp) && IsNaN(m_value); } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator ==(Double left, Double right) { return left == right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator !=(Double left, Double right) { return left != right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator <(Double left, Double right) { return left < right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator >(Double left, Double right) { return left > right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator <=(Double left, Double right) { return left <= right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator >=(Double left, Double right) { return left >= right; diff --git a/src/mscorlib/shared/System/Single.cs b/src/mscorlib/shared/System/Single.cs index 2bdc2a9..676c654 100644 --- a/src/mscorlib/shared/System/Single.cs +++ b/src/mscorlib/shared/System/Single.cs @@ -11,20 +11,20 @@ ** ===========================================================*/ -using System.Globalization; using System; -using System.Runtime.InteropServices; +using System.Diagnostics.Contracts; +using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; -using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; namespace System { [Serializable] - [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] - [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct Single : IComparable, IFormattable, IConvertible - , IComparable, IEquatable + [StructLayout(LayoutKind.Sequential)] + [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public struct Single : IComparable, IConvertible, IFormattable, IComparable, IEquatable { private float m_value; // Do not rename (binary serialization) @@ -38,11 +38,12 @@ namespace System public const float NegativeInfinity = (float)-1.0 / (float)0.0; public const float NaN = (float)0.0 / (float)0.0; - internal static float NegativeZero = BitConverter.Int32BitsToSingle(unchecked((int)0x80000000)); + // We use this explicit definition to avoid the confusion between 0.0 and -0.0. + internal const float NegativeZero = (float)-0.0; /// Determines whether the specified value is finite (zero, subnormal, or normal). [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsFinite(float f) { @@ -52,7 +53,7 @@ namespace System /// Determines whether the specified value is infinite. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsInfinity(float f) { @@ -62,7 +63,7 @@ namespace System /// Determines whether the specified value is NaN. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsNaN(float f) { @@ -72,7 +73,7 @@ namespace System /// Determines whether the specified value is negative. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsNegative(float f) { @@ -82,7 +83,7 @@ namespace System /// Determines whether the specified value is negative infinity. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsNegativeInfinity(float f) { @@ -91,7 +92,7 @@ namespace System /// Determines whether the specified value is normal. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] // This is probably not worth inlining, it has branches and should be rarely called public unsafe static bool IsNormal(float f) { @@ -102,7 +103,7 @@ namespace System /// Determines whether the specified value is positive infinity. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe static bool IsPositiveInfinity(float f) { @@ -111,7 +112,7 @@ namespace System /// Determines whether the specified value is subnormal. [Pure] - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] // This is probably not worth inlining, it has branches and should be rarely called public unsafe static bool IsSubnormal(float f) { @@ -162,37 +163,37 @@ namespace System return 1; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator ==(Single left, Single right) { return left == right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator !=(Single left, Single right) { return left != right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator <(Single left, Single right) { return left < right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator >(Single left, Single right) { return left > right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator <=(Single left, Single right) { return left <= right; } - [System.Runtime.Versioning.NonVersionable] + [NonVersionable] public static bool operator >=(Single left, Single right) { return left >= right; -- 2.7.4