diff options
author | dotnet-bot <dotnet-bot@microsoft.com> | 2022-02-12 02:44:09 +0300 |
---|---|---|
committer | dotnet-bot <dotnet-bot@microsoft.com> | 2022-02-12 02:44:09 +0300 |
commit | cceab9c16c8f698c643f31ac6a426ee0498e7f30 (patch) | |
tree | 0b795ee46399cae28a3dbc71c33b6759bbeb7df8 /src/libraries | |
parent | 6bc9982fa43ec7b0a9d5f225454085d2fc54c9fa (diff) | |
parent | a5a00042d08cfe495816c89845bf67ed553ca433 (diff) |
Merge in 'release/6.0' changes
Diffstat (limited to 'src/libraries')
13 files changed, 1964 insertions, 65 deletions
diff --git a/src/libraries/Native/AnyOS/zlib/pal_zlib.c b/src/libraries/Native/AnyOS/zlib/pal_zlib.c index aa4dcdca8a2..4d0b05c6629 100644 --- a/src/libraries/Native/AnyOS/zlib/pal_zlib.c +++ b/src/libraries/Native/AnyOS/zlib/pal_zlib.c @@ -7,6 +7,9 @@ #ifdef _WIN32 #define c_static_assert(e) static_assert((e),"") +#endif + +#if defined(_WIN32) || defined(__EMSCRIPTEN__) #include "../../Windows/System.IO.Compression.Native/zlib/zlib.h" #else #include "pal_utilities.h" diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index f68e1acef69..89c20051c89 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -1,9 +1,5 @@ project(System.IO.Compression.Native C) -if (CLR_CMAKE_TARGET_BROWSER) - add_definitions(-s USE_ZLIB) -endif() - include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) set(NATIVE_LIBS_EXTRA) @@ -13,7 +9,21 @@ set(NATIVECOMPRESSION_SOURCES ../../AnyOS/zlib/pal_zlib.c ) -if (NOT CLR_CMAKE_TARGET_BROWSER) +if (CLR_CMAKE_TARGET_BROWSER) + set (NATIVECOMPRESSION_SOURCES + ${NATIVECOMPRESSION_SOURCES} + ../../Windows/System.IO.Compression.Native/zlib/adler32.c + ../../Windows/System.IO.Compression.Native/zlib/compress.c + ../../Windows/System.IO.Compression.Native/zlib/crc32.c + ../../Windows/System.IO.Compression.Native/zlib/deflate.c + ../../Windows/System.IO.Compression.Native/zlib/inffast.c + ../../Windows/System.IO.Compression.Native/zlib/inflate.c + ../../Windows/System.IO.Compression.Native/zlib/inftrees.c + ../../Windows/System.IO.Compression.Native/zlib/trees.c + ../../Windows/System.IO.Compression.Native/zlib/zutil.c + ) + set_source_files_properties(${NATIVECOMPRESSION_SOURCES} PROPERTIES COMPILE_FLAGS -Wno-implicit-fallthrough) +else() #Include Brotli include files include_directories("../../AnyOS/brotli/include") diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index c651da612d5..cb95472d7f9 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -528,6 +528,9 @@ <data name="Arg_MustBeInterface" xml:space="preserve"> <value>Type passed must be an interface.</value> </data> + <data name="Arg_MustBeNFloat" xml:space="preserve"> + <value>Object must be of type NFloat.</value> + </data> <data name="Arg_MustBePointer" xml:space="preserve"> <value>Type must be a Pointer.</value> </data> diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs index e3cb842f2a5..62d9a8d30e1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs @@ -2,7 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using Internal.Runtime.CompilerServices; #pragma warning disable SA1121 // We use our own aliases since they differ per platform #if TARGET_32BIT @@ -13,65 +17,691 @@ using NativeType = System.Double; namespace System.Runtime.InteropServices { - /// <summary> - /// <see cref="NFloat"/> is an immutable value type that represents a floating type that has the same size - /// as the native integer size. - /// It is meant to be used as an exchange type at the managed/unmanaged boundary to accurately represent - /// in managed code unmanaged APIs that use a type alias for C or C++'s <c>float</c> on 32-bit platforms - /// or <c>double</c> on 64-bit platforms, such as the CGFloat type in libraries provided by Apple. - /// </summary> + /// <summary>Defines an immutable value type that represents a floating type that has the same size as the native integer size.</summary> + /// <remarks>It is meant to be used as an exchange type at the managed/unmanaged boundary to accurately represent in managed code unmanaged APIs that use a type alias for C or C++'s <c>float</c> on 32-bit platforms or <c>double</c> on 64-bit platforms, such as the CGFloat type in libraries provided by Apple.</remarks> [Intrinsic] - public readonly struct NFloat : IEquatable<NFloat> + public readonly struct NFloat + : IComparable, + IComparable<NFloat>, + IEquatable<NFloat>, + ISpanFormattable { + private const NumberStyles DefaultNumberStyles = NumberStyles.Float | NumberStyles.AllowThousands; + private readonly NativeType _value; - /// <summary> - /// Constructs an instance from a 32-bit floating point value. - /// </summary> - /// <param name="value">The floating-point vaule.</param> + /// <summary>Constructs an instance from a 32-bit floating point value.</summary> + /// <param name="value">The floating-point value.</param> + [NonVersionable] public NFloat(float value) { _value = value; } - /// <summary> - /// Constructs an instance from a 64-bit floating point value. - /// </summary> - /// <param name="value">The floating-point vaule.</param> + /// <summary>Constructs an instance from a 64-bit floating point value.</summary> + /// <param name="value">The floating-point value.</param> + [NonVersionable] public NFloat(double value) { _value = (NativeType)value; } - /// <summary> - /// The underlying floating-point value of this instance. - /// </summary> - public double Value => _value; + /// <summary>Represents the smallest positive NFloat value that is greater than zero.</summary> + public static NFloat Epsilon + { + [NonVersionable] + get => new NFloat(NativeType.Epsilon); + } + + /// <summary>Represents the largest finite value of a NFloat.</summary> + public static NFloat MaxValue + { + [NonVersionable] + get => new NFloat(NativeType.MaxValue); + } + + /// <summary>Represents the smallest finite value of a NFloat.</summary> + public static NFloat MinValue + { + [NonVersionable] + get => new NFloat(NativeType.MinValue); + } + + /// <summary>Represents a value that is not a number (NaN).</summary> + public static NFloat NaN + { + [NonVersionable] + get => new NFloat(NativeType.NaN); + } + + /// <summary>Represents negative infinity.</summary> + public static NFloat NegativeInfinity + { + [NonVersionable] + get => new NFloat(NativeType.NegativeInfinity); + } + + /// <summary>Represents positive infinity.</summary> + public static NFloat PositiveInfinity + { + [NonVersionable] + get => new NFloat(NativeType.PositiveInfinity); + } + + /// <summary>Gets the size, in bytes, of an NFloat.</summary> + public static int Size + { + [NonVersionable] + get => sizeof(NativeType); + } + + /// <summary>The underlying floating-point value of this instance.</summary> + public double Value + { + [NonVersionable] + get => _value; + } + + // + // Unary Arithmetic + // + + /// <summary>Computes the unary plus of a value.</summary> + /// <param name="value">The value for which to compute its unary plus.</param> + /// <returns>The unary plus of <paramref name="value" />.</returns> + [NonVersionable] + public static NFloat operator +(NFloat value) => value; + + /// <summary>Computes the unary negation of a value.</summary> + /// <param name="value">The value for which to compute its unary negation.</param> + /// <returns>The unary negation of <paramref name="value" />.</returns> + [NonVersionable] + public static NFloat operator -(NFloat value) => new NFloat(-value._value); + + /// <summary>Increments a value.</summary> + /// <param name="value">The value to increment.</param> + /// <returns>The result of incrementing <paramref name="value" />.</returns> + [NonVersionable] + public static NFloat operator ++(NFloat value) => new NFloat(value._value + 1); + + /// <summary>Decrements a value.</summary> + /// <param name="value">The value to decrement.</param> + /// <returns>The result of decrementing <paramref name="value" />.</returns> + [NonVersionable] + public static NFloat operator --(NFloat value) => new NFloat(value._value - 1); + + // + // Binary Arithmetic + // + + /// <summary>Adds two values together to compute their sum.</summary> + /// <param name="left">The value to which <paramref name="right" /> is added.</param> + /// <param name="right">The value which is added to <paramref name="left" />.</param> + /// <returns>The sum of <paramref name="left" /> and <paramref name="right" />.</returns> + [NonVersionable] + public static NFloat operator +(NFloat left, NFloat right) => new NFloat(left._value + right._value); + + /// <summary>Subtracts two values to compute their difference.</summary> + /// <param name="left">The value from which <paramref name="right" /> is subtracted.</param> + /// <param name="right">The value which is subtracted from <paramref name="left" />.</param> + /// <returns>The difference of <paramref name="right" /> subtracted from <paramref name="left" />.</returns> + [NonVersionable] + public static NFloat operator -(NFloat left, NFloat right) => new NFloat(left._value - right._value); + + /// <summary>Multiplies two values together to compute their product.</summary> + /// <param name="left">The value which <paramref name="right" /> multiplies.</param> + /// <param name="right">The value which multiplies <paramref name="left" />.</param> + /// <returns>The product of <paramref name="left" /> divided-by <paramref name="right" />.</returns> + [NonVersionable] + public static NFloat operator *(NFloat left, NFloat right) => new NFloat(left._value * right._value); + + /// <summary>Divides two values together to compute their quotient.</summary> + /// <param name="left">The value which <paramref name="right" /> divides.</param> + /// <param name="right">The value which divides <paramref name="left" />.</param> + /// <returns>The quotient of <paramref name="left" /> divided-by <paramref name="right" />.</returns> + [NonVersionable] + public static NFloat operator /(NFloat left, NFloat right) => new NFloat(left._value / right._value); + + /// <summary>Divides two values together to compute their remainder.</summary> + /// <param name="left">The value which <paramref name="right" /> divides.</param> + /// <param name="right">The value which divides <paramref name="left" />.</param> + /// <returns>The remainder of <paramref name="left" /> divided-by <paramref name="right" />.</returns> + [NonVersionable] + public static NFloat operator %(NFloat left, NFloat right) => new NFloat(left._value % right._value); + + // + // Comparisons + // + + /// <summary>Compares two values to determine equality.</summary> + /// <param name="left">The value to compare with <paramref name="right" />.</param> + /// <param name="right">The value to compare with <paramref name="left" />.</param> + /// <returns><c>true</c> if <paramref name="left" /> is equal to <paramref name="right" />; otherwise, <c>false</c>.</returns> + [NonVersionable] + public static bool operator ==(NFloat left, NFloat right) => left._value == right._value; + + /// <summary>Compares two values to determine inequality.</summary> + /// <param name="left">The value to compare with <paramref name="right" />.</param> + /// <param name="right">The value to compare with <paramref name="left" />.</param> + /// <returns><c>true</c> if <paramref name="left" /> is not equal to <paramref name="right" />; otherwise, <c>false</c>.</returns> + [NonVersionable] + public static bool operator !=(NFloat left, NFloat right) => left._value != right._value; + + /// <summary>Compares two values to determine which is less.</summary> + /// <param name="left">The value to compare with <paramref name="right" />.</param> + /// <param name="right">The value to compare with <paramref name="left" />.</param> + /// <returns><c>true</c> if <paramref name="left" /> is less than <paramref name="right" />; otherwise, <c>false</c>.</returns> + [NonVersionable] + public static bool operator <(NFloat left, NFloat right) => left._value < right._value; + + /// <summary>Compares two values to determine which is less or equal.</summary> + /// <param name="left">The value to compare with <paramref name="right" />.</param> + /// <param name="right">The value to compare with <paramref name="left" />.</param> + /// <returns><c>true</c> if <paramref name="left" /> is less than or equal to <paramref name="right" />; otherwise, <c>false</c>.</returns> + [NonVersionable] + public static bool operator <=(NFloat left, NFloat right) => left._value <= right._value; + + /// <summary>Compares two values to determine which is greater.</summary> + /// <param name="left">The value to compare with <paramref name="right" />.</param> + /// <param name="right">The value to compare with <paramref name="left" />.</param> + /// <returns><c>true</c> if <paramref name="left" /> is greater than <paramref name="right" />; otherwise, <c>false</c>.</returns> + [NonVersionable] + public static bool operator >(NFloat left, NFloat right) => left._value > right._value; + + /// <summary>Compares two values to determine which is greater or equal.</summary> + /// <param name="left">The value to compare with <paramref name="right" />.</param> + /// <param name="right">The value to compare with <paramref name="left" />.</param> + /// <returns><c>true</c> if <paramref name="left" /> is greater than or equal to <paramref name="right" />; otherwise, <c>false</c>.</returns> + [NonVersionable] + public static bool operator >=(NFloat left, NFloat right) => left._value >= right._value; + + // + // Explicit Convert To NFloat + // + + /// <summary>Explicitly converts a <see cref="System.Decimal" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static explicit operator NFloat(decimal value) => new NFloat((NativeType)value); + + /// <summary>Explicitly converts a <see cref="System.Double" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static explicit operator NFloat(double value) => new NFloat((NativeType)value); + + // + // Explicit Convert From NFloat + // + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Byte" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Byte" /> value.</returns> + [NonVersionable] + public static explicit operator byte(NFloat value) => (byte)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Char" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Char" /> value.</returns> + [NonVersionable] + public static explicit operator char(NFloat value) => (char)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Decimal" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Decimal" /> value.</returns> + [NonVersionable] + public static explicit operator decimal(NFloat value) => (decimal)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Int16" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Int16" /> value.</returns> + [NonVersionable] + public static explicit operator short(NFloat value) => (short)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Int32" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Int32" /> value.</returns> + [NonVersionable] + public static explicit operator int(NFloat value) => (int)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Int64" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Int64" /> value.</returns> + [NonVersionable] + public static explicit operator long(NFloat value) => (long)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.IntPtr" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.IntPtr" /> value.</returns> + [NonVersionable] + public static explicit operator nint(NFloat value) => (nint)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.SByte" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.SByte" /> value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator sbyte(NFloat value) => (sbyte)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Single" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Single" /> value.</returns> + [NonVersionable] + public static explicit operator float(NFloat value) => (float)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.UInt16" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt16" /> value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator ushort(NFloat value) => (ushort)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.UInt32" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt32" /> value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator uint(NFloat value) => (uint)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.UInt64" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt64" /> value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator ulong(NFloat value) => (ulong)(value._value); + + /// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="System.UIntPtr" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UIntPtr" /> value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator nuint(NFloat value) => (nuint)(value._value); + + // + // Implicit Convert To NFloat + // - /// <summary> - /// Returns a value indicating whether this instance is equal to a specified object. - /// </summary> - /// <param name="o">An object to compare with this instance.</param> - /// <returns><c>true</c> if <paramref name="o"/> is an instance of <see cref="NFloat"/> and equals the value of this instance; otherwise, <c>false</c>.</returns> - public override bool Equals([NotNullWhen(true)] object? o) => o is NFloat other && Equals(other); + /// <summary>Implicitly converts a <see cref="System.Byte" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(byte value) => new NFloat((NativeType)value); - /// <summary> - /// Returns a value indicating whether this instance is equal to a specified <see cref="CLong"/> value. - /// </summary> + /// <summary>Implicitly converts a <see cref="System.Char" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(char value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.Int16" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(short value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.Int32" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(int value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.Int64" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(long value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.IntPtr" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(nint value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.SByte" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(sbyte value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.Single" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + public static implicit operator NFloat(float value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.UInt16" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(ushort value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.UInt32" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(uint value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.UInt64" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(ulong value) => new NFloat((NativeType)value); + + /// <summary>Implicitly converts a <see cref="System.UIntPtr" /> value to its nearest representable native-sized floating-point value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable native-sized floating-point value.</returns> + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(nuint value) => new NFloat((NativeType)value); + + // + // Implicit Convert From NFloat + // + + /// <summary>Implicitly converts a native-sized floating-point value to its nearest representable <see cref="System.Double" /> value.</summary> + /// <param name="value">The value to convert.</param> + /// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.Double" /> value.</returns> + public static implicit operator double(NFloat value) => (double)(value._value); + + /// <summary>Determines whether the specified value is finite (zero, subnormal, or normal).</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is finite (zero, subnormal or normal); <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsFinite(NFloat value) => NativeType.IsFinite(value._value); + + /// <summary>Determines whether the specified value is infinite (positive or negative infinity).</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is infinite (positive or negative infinity); <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsInfinity(NFloat value) => NativeType.IsInfinity(value._value); + + /// <summary>Determines whether the specified value is NaN (not a number).</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is NaN (not a number); <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsNaN(NFloat value) => NativeType.IsNaN(value._value); + + /// <summary>Determines whether the specified value is negative.</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is negative; <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsNegative(NFloat value) => NativeType.IsNegative(value._value); + + /// <summary>Determines whether the specified value is negative infinity.</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is negative infinity; <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsNegativeInfinity(NFloat value) => NativeType.IsNegativeInfinity(value._value); + + /// <summary>Determines whether the specified value is normal.</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is normal; <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsNormal(NFloat value) => NativeType.IsNormal(value._value); + + /// <summary>Determines whether the specified value is positive infinity.</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is positive infinity; <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsPositiveInfinity(NFloat value) => NativeType.IsPositiveInfinity(value._value); + + /// <summary>Determines whether the specified value is subnormal.</summary> + /// <param name="value">The floating-point value.</param> + /// <returns><c>true</c> if the value is subnormal; <c>false</c> otherwise.</returns> + [NonVersionable] + public static bool IsSubnormal(NFloat value) => NativeType.IsSubnormal(value._value); + + /// <summary>Converts the string representation of a number to its floating-point number equivalent.</summary> + /// <param name="s">A string that contains the number to convert.</param> + /// <returns>A floating-point number that is equivalent to the numeric value or symbol specified in <paramref name="s" />.</returns> + /// <exception cref="ArgumentNullException"><paramref name="s" /> is <c>null</c>.</exception> + /// <exception cref="FormatException"><paramref name="s" /> does not represent a number in a valid format.</exception> + public static NFloat Parse(string s) + { + var result = NativeType.Parse(s); + return new NFloat(result); + } + + /// <summary>Converts the string representation of a number in a specified style to its floating-point number equivalent.</summary> + /// <param name="s">A string that contains the number to convert.</param> + /// <param name="style">A bitwise combination of enumeration values that indicate the style elements that can be present in <paramref name="s" />.</param> + /// <returns>A floating-point number that is equivalent to the numeric value or symbol specified in <paramref name="s" />.</returns> + /// <exception cref="ArgumentException"> + /// <para><paramref name="style" /> is not a <see cref="NumberStyles" /> value.</para> + /// <para>-or-</para> + /// <para><paramref name="style" /> includes the <see cref="NumberStyles.AllowHexSpecifier" /> value.</para> + /// </exception> + /// <exception cref="ArgumentNullException"><paramref name="s" /> is <c>null</c>.</exception> + /// <exception cref="FormatException"><paramref name="s" /> does not represent a number in a valid format.</exception> + public static NFloat Parse(string s, NumberStyles style) + { + var result = NativeType.Parse(s, style); + return new NFloat(result); + } + + /// <summary>Converts the string representation of a number in a specified culture-specific format to its floating-point number equivalent.</summary> + /// <param name="s">A string that contains the number to convert.</param> + /// <param name="provider">An object that supplies culture-specific formatting information about <paramref name="s" />.</param> + /// <returns>A floating-point number that is equivalent to the numeric value or symbol specified in <paramref name="s" />.</returns> + /// <exception cref="ArgumentNullException"><paramref name="s" /> is <c>null</c>.</exception> + /// <exception cref="FormatException"><paramref name="s" /> does not represent a number in a valid format.</exception> + public static NFloat Parse(string s, IFormatProvider? provider) + { + var result = NativeType.Parse(s, provider); + return new NFloat(result); + } + + /// <summary>Converts the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent.</summary> + /// <param name="s">A string that contains the number to convert.</param> + /// <param name="style">A bitwise combination of enumeration values that indicate the style elements that can be present in <paramref name="s" />.</param> + /// <param name="provider">An object that supplies culture-specific formatting information about <paramref name="s" />.</param> + /// <returns>A floating-point number that is equivalent to the numeric value or symbol specified in <paramref name="s" />.</returns> + /// <exception cref="ArgumentException"> + /// <para><paramref name="style" /> is not a <see cref="NumberStyles" /> value.</para> + /// <para>-or-</para> + /// <para><paramref name="style" /> includes the <see cref="NumberStyles.AllowHexSpecifier" /> value.</para> + /// </exception> + /// <exception cref="ArgumentNullException"><paramref name="s" /> is <c>null</c>.</exception> + /// <exception cref="FormatException"><paramref name="s" /> does not represent a number in a valid format.</exception> + public static NFloat Parse(string s, NumberStyles style, IFormatProvider? provider) + { + var result = NativeType.Parse(s, style, provider); + return new NFloat(result); + } + + /// <summary>Converts a character span that contains the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent.</summary> + /// <param name="s">A character span that contains the number to convert.</param> + /// <param name="style">A bitwise combination of enumeration values that indicate the style elements that can be present in <paramref name="s" />.</param> + /// <param name="provider">An object that supplies culture-specific formatting information about <paramref name="s" />.</param> + /// <returns>A floating-point number that is equivalent to the numeric value or symbol specified in <paramref name="s" />.</returns> + /// <exception cref="ArgumentException"> + /// <para><paramref name="style" /> is not a <see cref="NumberStyles" /> value.</para> + /// <para>-or-</para> + /// <para><paramref name="style" /> includes the <see cref="NumberStyles.AllowHexSpecifier" /> value.</para> + /// </exception> + /// <exception cref="FormatException"><paramref name="s" /> does not represent a number in a valid format.</exception> + public static NFloat Parse(ReadOnlySpan<char> s, NumberStyles style = DefaultNumberStyles, IFormatProvider? provider = null) + { + var result = NativeType.Parse(s, style, provider); + return new NFloat(result); + } + + /// <summary>Tries to convert the string representation of a number to its floating-point number equivalent.</summary> + /// <param name="s">A read-only character span that contains the number to convert.</param> + /// <param name="result">When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in <paramref name="s" /> if the conversion succeeded or zero if the conversion failed. The conversion fails if the <paramref name="s" /> is <c>null</c>, <see cref="string.Empty" />, or is not in a valid format. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param> + /// <returns><c>true</c> if <paramref name="s" /> was converted successfully; otherwise, false.</returns> + public static bool TryParse([NotNullWhen(true)] string? s, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, out Unsafe.As<NFloat, NativeType>(ref result)); + } + + /// <summary>Tries to convert a character span containing the string representation of a number to its floating-point number equivalent.</summary> + /// <param name="s">A read-only character span that contains the number to convert.</param> + /// <param name="result">When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in <paramref name="s" /> if the conversion succeeded or zero if the conversion failed. The conversion fails if the <paramref name="s" /> is <see cref="string.Empty" /> or is not in a valid format. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param> + /// <returns><c>true</c> if <paramref name="s" /> was converted successfully; otherwise, false.</returns> + public static bool TryParse(ReadOnlySpan<char> s, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, out Unsafe.As<NFloat, NativeType>(ref result)); + } + + /// <summary>Tries to convert the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent.</summary> + /// <param name="s">A read-only character span that contains the number to convert.</param> + /// <param name="style">A bitwise combination of enumeration values that indicate the style elements that can be present in <paramref name="s" />.</param> + /// <param name="provider">An object that supplies culture-specific formatting information about <paramref name="s" />.</param> + /// <param name="result">When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in <paramref name="s" /> if the conversion succeeded or zero if the conversion failed. The conversion fails if the <paramref name="s" /> is <c>null</c>, <see cref="string.Empty" />, or is not in a format compliant with <paramref name="style" />, or if <paramref name="style" /> is not a valid combination of <see cref="NumberStyles" /> enumeration constants. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param> + /// <returns><c>true</c> if <paramref name="s" /> was converted successfully; otherwise, false.</returns> + /// <exception cref="ArgumentException"> + /// <para><paramref name="style" /> is not a <see cref="NumberStyles" /> value.</para> + /// <para>-or-</para> + /// <para><paramref name="style" /> includes the <see cref="NumberStyles.AllowHexSpecifier" /> value.</para> + /// </exception> + public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, style, provider, out Unsafe.As<NFloat, NativeType>(ref result)); + } + + /// <summary>Tries to convert a character span containing the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent.</summary> + /// <param name="s">A read-only character span that contains the number to convert.</param> + /// <param name="style">A bitwise combination of enumeration values that indicate the style elements that can be present in <paramref name="s" />.</param> + /// <param name="provider">An object that supplies culture-specific formatting information about <paramref name="s" />.</param> + /// <param name="result">When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in <paramref name="s" /> if the conversion succeeded or zero if the conversion failed. The conversion fails if the <paramref name="s" /> is <see cref="string.Empty" /> or is not in a format compliant with <paramref name="style" />, or if <paramref name="style" /> is not a valid combination of <see cref="NumberStyles" /> enumeration constants. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param> + /// <returns><c>true</c> if <paramref name="s" /> was converted successfully; otherwise, false.</returns> + /// <exception cref="ArgumentException"> + /// <para><paramref name="style" /> is not a <see cref="NumberStyles" /> value.</para> + /// <para>-or-</para> + /// <para><paramref name="style" /> includes the <see cref="NumberStyles.AllowHexSpecifier" /> value.</para> + /// </exception> + public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, style, provider, out Unsafe.As<NFloat, NativeType>(ref result)); + } + + /// <summary>Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.</summary> + /// <param name="obj">An object to compare, or <c>null</c>.</param> + /// <returns> + /// <para>A signed number indicating the relative values of this instance and <paramref name="obj" />.</para> + /// <list type="table"> + /// <listheader> + /// <term>Return Value</term> + /// <description>Description</description> + /// </listheader> + /// <item> + /// <term>Less than zero</term> + /// <description>This instance is less than <paramref name="obj" />, or this instance is not a number and <paramref name="obj" /> is a number.</description> + /// </item> + /// <item> + /// <term>Zero</term> + /// <description>This instance is equal to <paramref name="obj" />, or both this instance and <paramref name="obj" /> are not a number.</description> + /// </item> + /// <item> + /// <term>Greater than zero</term> + /// <description>This instance is greater than <paramref name="obj" />, or this instance is a number and <paramref name="obj" /> is not a number or <paramref name="obj" /> is <c>null</c>.</description> + /// </item> + /// </list> + /// </returns> + /// <exception cref="System.ArgumentException"><paramref name="obj" /> is not a <see cref="NFloat" />.</exception> + public int CompareTo(object? obj) + { + if (obj is NFloat other) + { + if (_value < other._value) return -1; + if (_value > other._value) return 1; + if (_value == other._value) return 0; + + // At least one of the values is NaN. + if (NativeType.IsNaN(_value)) + { + return NativeType.IsNaN(other._value) ? 0 : -1; + } + else + { + return 1; + } + } + else if (obj is null) + { + return 1; + } + + throw new ArgumentException(SR.Arg_MustBeNFloat); + } + + /// <summary>Compares this instance to a specified floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified floating-point number.</summary> + /// <param name="other">A floating-point number to compare.</param> + /// <returns> + /// <para>A signed number indicating the relative values of this instance and <paramref name="other" />.</para> + /// <list type="table"> + /// <listheader> + /// <term>Return Value</term> + /// <description>Description</description> + /// </listheader> + /// <item> + /// <term>Less than zero</term> + /// <description>This instance is less than <paramref name="other" />, or this instance is not a number and <paramref name="other" /> is a number.</description> + /// </item> + /// <item> + /// <term>Zero</term> + /// <description>This instance is equal to <paramref name="other" />, or both this instance and <paramref name="other" /> are not a number.</description> + /// </item> + /// <item> + /// <term>Greater than zero</term> + /// <description>This instance is greater than <paramref name="other" />, or this instance is a number and <paramref name="other" /> is not a number.</description> + /// </item> + /// </list> + /// </returns> + public int CompareTo(NFloat other) => _value.CompareTo(other._value); + + /// <summary>Returns a value indicating whether this instance is equal to a specified object.</summary> + /// <param name="obj">An object to compare with this instance.</param> + /// <returns><c>true</c> if <paramref name="obj"/> is an instance of <see cref="NFloat"/> and equals the value of this instance; otherwise, <c>false</c>.</returns> + public override bool Equals([NotNullWhen(true)] object? obj) => (obj is NFloat other) && Equals(other); + + /// <summary>Returns a value indicating whether this instance is equal to a specified <see cref="NFloat" /> value.</summary> /// <param name="other">An <see cref="NFloat"/> value to compare to this instance.</param> /// <returns><c>true</c> if <paramref name="other"/> has the same value as this instance; otherwise, <c>false</c>.</returns> public bool Equals(NFloat other) => _value.Equals(other._value); - /// <summary> - /// Returns the hash code for this instance. - /// </summary> + /// <summary>Returns the hash code for this instance.</summary> /// <returns>A 32-bit signed integer hash code.</returns> public override int GetHashCode() => _value.GetHashCode(); - /// <summary> - /// Converts the numeric value of this instance to its equivalent string representation. - /// </summary> + /// <summary>Converts the numeric value of this instance to its equivalent string representation.</summary> /// <returns>The string representation of the value of this instance.</returns> public override string ToString() => _value.ToString(); + + /// <summary>Converts the numeric value of this instance to its equivalent string representation using the specified format.</summary> + /// <param name="format">A numeric format string.</param> + /// <returns>The string representation of the value of this instance as specified by <paramref name="format" />.</returns> + /// <exception cref="FormatException"><paramref name="format" /> is invalid.</exception> + public string ToString(string? format) => _value.ToString(format); + + /// <summary>Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.</summary> + /// <param name="provider">An object that supplies culture-specific formatting information.</param> + /// <returns>The string representation of the value of this instance as specified by <paramref name="provider" />.</returns> + public string ToString(IFormatProvider? provider)=> _value.ToString(provider); + + /// <summary>Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.</summary> + /// <param name="format">A numeric format string.</param> + /// <param name="provider">An object that supplies culture-specific formatting information.</param> + /// <returns>The string representation of the value of this instance as specified by <paramref name="format" /> and <paramref name="provider" />.</returns> + /// <exception cref="FormatException"><paramref name="format" /> is invalid.</exception> + public string ToString(string? format, IFormatProvider? provider) => _value.ToString(format, provider); + + /// <summary>Tries to format the value of the current instance into the provided span of characters.</summary> + /// <param name="destination">The span in which to write this instance's value formatted as a span of characters.</param> + /// <param name="charsWritten">When this method returns, contains the number of characters that were written in <paramref name="destination" />.</param> + /// <param name="format">A span containing the characters that represent a standard or custom format string that defines the acceptable format for <paramref name="destination" />.</param> + /// <param name="provider">An optional object that supplies culture-specific formatting information for <paramref name="destination" />.</param> + /// <returns><c>true</c> if the formatting was successful; otherwise, <c>false</c>.</returns> + public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null) => _value.TryFormat(destination, out charsWritten, format, provider); } } diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/Directory.Build.props b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/Directory.Build.props new file mode 100644 index 00000000000..a2b7f43d878 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/Directory.Build.props @@ -0,0 +1,9 @@ +<Project> + <Import Project="..\Directory.Build.props" /> + <PropertyGroup> + <!-- Disable all binplacing since this assembly will clash with the real System.Runtime.InteropServices --> + <EnableBinPlacing>false</EnableBinPlacing> + <StrongNameKeyId>Microsoft</StrongNameKeyId> + <IncludePlatformAttributes>true</IncludePlatformAttributes> + </PropertyGroup> +</Project> diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/System.Runtime.InteropServices.NFloat.Internal.sln b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/System.Runtime.InteropServices.NFloat.Internal.sln new file mode 100644 index 00000000000..a74a031810b --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/System.Runtime.InteropServices.NFloat.Internal.sln @@ -0,0 +1,198 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Private.CoreLib", "..\..\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj", "{94B59BA0-491F-4B59-ADFF-A057EC3EC835}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServices.Unsafe", "..\System.Runtime.CompilerServices.Unsafe\ref\System.Runtime.CompilerServices.Unsafe.csproj", "{5BB5F99F-1052-4EB4-B12E-7863805661F3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServices.Unsafe", "..\System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj", "{04BA3E3C-6979-4792-B19E-C797AD607F42}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.NFloat.Internal", "ref\System.Runtime.InteropServices.NFloat.Internal.csproj", "{8671F164-F78C-44FA-93B7-A310F67890FE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.NFloat.Internal", "src\System.Runtime.InteropServices.NFloat.Internal.csproj", "{4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.ComDisabled.Tests", "tests\ComDisabled\System.Runtime.InteropServices.ComDisabled.Tests.csproj", "{6D2197E6-D3DF-43AE-9BEE-3573018639F9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.NFloat.Internal.Tests", "tests\System.Runtime.InteropServices.NFloat.Internal.Tests.csproj", "{E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{FB99AC59-1744-4F12-A4B0-0D54FCA048BF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B1678CCD-95C8-4419-B9F9-14A03061BE4B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{D893B9AA-57C5-49E3-97B1-12CC62D84307}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + Checked|Any CPU = Checked|Any CPU + Checked|x64 = Checked|x64 + Checked|x86 = Checked|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x64.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x64.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x86.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x86.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|Any CPU.Build.0 = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x64.ActiveCfg = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x64.Build.0 = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x86.ActiveCfg = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x86.Build.0 = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|Any CPU.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x64.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x64.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x86.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x86.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x64.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x64.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x86.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x86.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|Any CPU.Build.0 = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x64.ActiveCfg = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x64.Build.0 = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x86.ActiveCfg = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x86.Build.0 = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|Any CPU.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x64.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x64.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x86.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x86.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x64.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x64.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x86.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x86.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|Any CPU.Build.0 = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x64.ActiveCfg = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x64.Build.0 = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x86.ActiveCfg = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x86.Build.0 = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|Any CPU.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x64.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x64.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x86.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x86.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x64.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x64.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x86.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x86.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|Any CPU.Build.0 = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x64.ActiveCfg = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x64.Build.0 = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x86.ActiveCfg = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x86.Build.0 = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|Any CPU.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x64.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x64.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x86.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x86.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x64.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x64.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x86.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x86.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|Any CPU.Build.0 = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x64.ActiveCfg = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x64.Build.0 = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x86.ActiveCfg = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x86.Build.0 = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|Any CPU.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x64.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x64.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x86.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x86.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x64.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x64.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x86.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x86.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.Build.0 = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x64.ActiveCfg = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x64.Build.0 = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x86.ActiveCfg = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x86.Build.0 = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|Any CPU.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x64.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x64.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x86.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x86.Build.0 = Debug|Any CPU + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|Any CPU.ActiveCfg = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|Any CPU.Build.0 = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x64.ActiveCfg = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x64.Build.0 = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x86.ActiveCfg = Debug|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x86.Build.0 = Debug|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|Any CPU.ActiveCfg = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|Any CPU.Build.0 = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x64.ActiveCfg = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x64.Build.0 = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x86.ActiveCfg = Release|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x86.Build.0 = Release|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|Any CPU.ActiveCfg = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|Any CPU.Build.0 = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x64.ActiveCfg = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x64.Build.0 = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x86.ActiveCfg = Checked|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x86.Build.0 = Checked|x86 + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x64.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x86.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x86.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|Any CPU.Build.0 = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x64.ActiveCfg = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x64.Build.0 = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x86.ActiveCfg = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x86.Build.0 = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|Any CPU.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x64.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x64.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x86.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x86.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6D2197E6-D3DF-43AE-9BEE-3573018639F9} = {FB99AC59-1744-4F12-A4B0-0D54FCA048BF} + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664} = {FB99AC59-1744-4F12-A4B0-0D54FCA048BF} + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA} = {FB99AC59-1744-4F12-A4B0-0D54FCA048BF} + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1} = {B1678CCD-95C8-4419-B9F9-14A03061BE4B} + {04BA3E3C-6979-4792-B19E-C797AD607F42} = {B1678CCD-95C8-4419-B9F9-14A03061BE4B} + {94B59BA0-491F-4B59-ADFF-A057EC3EC835} = {B1678CCD-95C8-4419-B9F9-14A03061BE4B} + {8671F164-F78C-44FA-93B7-A310F67890FE} = {D893B9AA-57C5-49E3-97B1-12CC62D84307} + {5BB5F99F-1052-4EB4-B12E-7863805661F3} = {D893B9AA-57C5-49E3-97B1-12CC62D84307} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D4031401-FEB5-4CCF-91C1-38F5646B2BFD} + EndGlobalSection +EndGlobal diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/ref/System.Runtime.InteropServices.NFloat.Internal.csproj b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/ref/System.Runtime.InteropServices.NFloat.Internal.csproj new file mode 100644 index 00000000000..144688b2bf2 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/ref/System.Runtime.InteropServices.NFloat.Internal.csproj @@ -0,0 +1,44 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <AssemblyName>System.Runtime.InteropServices</AssemblyName> + <FeatureNFloat>true</FeatureNFloat> + <!-- disable warnings about obsolete APIs, + Remove warning disable when nullable attributes are respected, + Type has no accessible constructors which use only CLS-compliant types --> + <!-- Nullability of parameter 'name' doesn't match overridden member --> + <NoWarn>$(NoWarn);0809;0618;CS8614;CS8765;CS3015;NU5131</NoWarn> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks> + <Nullable>enable</Nullable> + </PropertyGroup> + <PropertyGroup Condition="'$(FeatureNFloat)' == 'true'"> + <!-- Place this assembly in the nuget ref folder --> + <BuildOutputTargetFolder>ref</BuildOutputTargetFolder> + <DefineConstants>$(DefineConstants);FEATURE_NFLOAT</DefineConstants> + <IsPackable>true</IsPackable> + <ServicingVersion>1</ServicingVersion> + <GeneratePackageOnBuild>true</GeneratePackageOnBuild> + <PackageDescription>Exposes additional NFloat APIs for Xamarin/Maui APIs from System.Runtime.InteropServices</PackageDescription> + <PackageId>$(MSBuildProjectName)</PackageId> + <!-- TODO: Remove when the package shipped with NET6. --> + <DisablePackageBaselineValidation>true</DisablePackageBaselineValidation> + </PropertyGroup> + <ItemGroup> + <Compile Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\ref\System.Runtime.InteropServices.cs" /> + <Compile Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\ref\System.Runtime.InteropServices.Forwards.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\System.Collections\ref\System.Collections.csproj" PrivateAssets="all" /> + <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" PrivateAssets="all" /> + </ItemGroup> + <Target Name="_ExperimentalUpdateFileVersion" + AfterTargets="_InitializeAssemblyVersion"> + <PropertyGroup> + <_FileVersionMaj>$(FileVersion.Split('.')[0])</_FileVersionMaj> + <_FileVersionMin>$(FileVersion.Split('.')[1])</_FileVersionMin> + <_FileVersionBld>$(FileVersion.Split('.')[2])</_FileVersionBld> + <_FileVersionRev>$(FileVersion.Split('.')[3])</_FileVersionRev> + <FileVersion>$(_FileVersionMaj).$([MSBuild]::Add($(_FileVersionMin), 100)).$(_FileVersionBld).$(_FileVersionRev)</FileVersion> + </PropertyGroup> + </Target> +</Project> diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/src/System.Runtime.InteropServices.NFloat.Internal.proj b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/src/System.Runtime.InteropServices.NFloat.Internal.proj new file mode 100644 index 00000000000..304633a1911 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/src/System.Runtime.InteropServices.NFloat.Internal.proj @@ -0,0 +1,7 @@ +<Project Sdk="Microsoft.Build.Traversal"> + + <ItemGroup> + <ProjectReference Include="..\ref\$(MSBuildProjectName).csproj" /> + </ItemGroup> + +</Project> diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/tests/System.Runtime.InteropServices.NFloat.Internal.Tests.csproj b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/tests/System.Runtime.InteropServices.NFloat.Internal.Tests.csproj new file mode 100644 index 00000000000..a8499d3dde8 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/tests/System.Runtime.InteropServices.NFloat.Internal.Tests.csproj @@ -0,0 +1,19 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <FeatureNFloat>true</FeatureNFloat> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks> + <TestRuntime>true</TestRuntime> + <IncludeRemoteExecutor>true</IncludeRemoteExecutor> + </PropertyGroup> + <PropertyGroup> + <DefineConstants Condition="'$(FeatureNFloat)' == 'true'">$(DefineConstants);FEATURE_NFLOAT</DefineConstants> + </PropertyGroup> + <ItemGroup> + <Compile Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\tests\System\Runtime\InteropServices\NFloatTests.cs" /> + </ItemGroup> + <ItemGroup> + <!-- it's a reference assembly, but the project system doesn't know that - include it during compilation, but don't publish it --> + <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices.NFloat.Internal\ref\System.Runtime.InteropServices.NFloat.Internal.csproj" IncludeAssets="compile" Private="false" /> + </ItemGroup> +</Project> diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index 6fa5eb10ea0..e7eb8164ddb 100644 --- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -157,13 +157,14 @@ namespace System.Runtime.InteropServices AutoDual = 2, } [System.CLSCompliantAttribute(false)] - public readonly struct CLong : IEquatable<CLong> + public readonly partial struct CLong : System.IEquatable<System.Runtime.InteropServices.CLong> { - public CLong(int value) { } - public CLong(nint value) { } + private readonly int _dummyPrimitive; + public CLong(int value) { throw null; } + public CLong(nint value) { throw null; } public nint Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } - public bool Equals(CLong other) { throw null; } + public bool Equals(System.Runtime.InteropServices.CLong other) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } @@ -294,13 +295,14 @@ namespace System.Runtime.InteropServices public ComUnregisterFunctionAttribute() { } } [System.CLSCompliantAttribute(false)] - public readonly struct CULong : IEquatable<CULong> + public readonly partial struct CULong : System.IEquatable<System.Runtime.InteropServices.CULong> { - public CULong(uint value) { } - public CULong(nuint value) { } + private readonly int _dummyPrimitive; + public CULong(uint value) { throw null; } + public CULong(nuint value) { throw null; } public nuint Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } - public bool Equals(CULong other) { throw null; } + public bool Equals(System.Runtime.InteropServices.CULong other) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } @@ -782,15 +784,109 @@ namespace System.Runtime.InteropServices [System.CLSCompliantAttribute(false)] public static void* Realloc(void* ptr, nuint byteCount) { throw null; } } - public readonly struct NFloat : IEquatable<NFloat> + public readonly partial struct NFloat : System.IEquatable<System.Runtime.InteropServices.NFloat> +#if FEATURE_NFLOAT +#pragma warning disable SA1001 + , System.IComparable, + System.IComparable<System.Runtime.InteropServices.NFloat>, + System.IFormattable, + System.ISpanFormattable +#pragma warning restore SA1001 +#endif // FEATURE_NFLOAT { - public NFloat(float value) { } - public NFloat(double value) { } + private readonly int _dummyPrimitive; + public NFloat(double value) { throw null; } + public NFloat(float value) { throw null; } public double Value { get { throw null; } } - public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } - public bool Equals(NFloat other) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public bool Equals(System.Runtime.InteropServices.NFloat other) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } +#if FEATURE_NFLOAT + public static System.Runtime.InteropServices.NFloat Epsilon { get { throw null; } } + public static System.Runtime.InteropServices.NFloat MaxValue { get { throw null; } } + public static System.Runtime.InteropServices.NFloat MinValue { get { throw null; } } + public static System.Runtime.InteropServices.NFloat NaN { get { throw null; } } + public static System.Runtime.InteropServices.NFloat NegativeInfinity { get { throw null; } } + public static System.Runtime.InteropServices.NFloat PositiveInfinity { get { throw null; } } + public static int Size { get { throw null; } } + public int CompareTo(object? obj) { throw null; } + public int CompareTo(System.Runtime.InteropServices.NFloat other) { throw null; } + public static bool IsFinite(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsInfinity(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNaN(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNegative(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNegativeInfinity(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNormal(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsPositiveInfinity(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsSubnormal(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator +(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator --(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator /(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator ==(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static explicit operator System.Runtime.InteropServices.NFloat (decimal value) { throw null; } + public static explicit operator System.Runtime.InteropServices.NFloat (double value) { throw null; } + public static explicit operator byte (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator char (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator decimal (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator short (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator int (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator long (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator nint (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator sbyte (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator float (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ushort (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator nuint (System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool operator >(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator >=(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (byte value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (char value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (short value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (int value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (long value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (nint value) { throw null; } + public static implicit operator double (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (sbyte value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (float value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (ulong value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (nuint value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator ++(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool operator !=(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator <(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator <=(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator %(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator *(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator -(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator -(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator +(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s, System.Globalization.NumberStyles style) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s, System.IFormatProvider? provider) { throw null; } + public string ToString(System.IFormatProvider? provider) { throw null; } + public string ToString(string? format) { throw null; } + public string ToString(string? format, System.IFormatProvider? provider) { throw null; } + public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; } + public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Runtime.InteropServices.NFloat result) { throw null; } + public static bool TryParse(System.ReadOnlySpan<char> s, out System.Runtime.InteropServices.NFloat result) { throw null; } + public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Runtime.InteropServices.NFloat result) { throw null; } + public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Runtime.InteropServices.NFloat result) { throw null; } +#endif // FEATURE_NFLOAT } [System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)] public sealed partial class OptionalAttribute : System.Attribute diff --git a/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt index dd2e06b69c3..7f9c02ebeff 100644 --- a/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt @@ -8,4 +8,80 @@ TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationClassContext' TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationConnectionType' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public void System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute..ctor()' does not exist in the reference but it does exist in the implementation. -Total Issues: 9 +CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.NFloat' does not implement interface 'System.IComparable' in the reference but it does in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.CompareTo(System.Object)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.CompareTo(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Epsilon.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsFinite(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsInfinity(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNaN(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNegative(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNegativeInfinity(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNormal(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsPositiveInfinity(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsSubnormal(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.MaxValue.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.MinValue.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.NaN.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.NegativeInfinity.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Addition(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Decrement(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Division(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_Equality(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation.C:\Users\tagoo\.nuget\packages\microsoft.dotnet.apicompat\6.0.0-beta.21614.2\build\Microsoft.DotNet.ApiCompat.targets(145,5): error : MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Explicit(System.Decimal)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Explicit(System.Double)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Byte System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Char System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Decimal System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int16 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int64 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.IntPtr System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.SByte System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Single System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UInt16 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UInt32 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UInt64 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UIntPtr System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_GreaterThan(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_GreaterThanOrEqual(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Byte)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Char)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Int16)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Int32)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Int64)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.IntPtr)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Double System.Runtime.InteropServices.NFloat.op_Implicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.SByte)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Single)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UInt16)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UInt32)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UInt64)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UIntPtr)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Increment(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_Inequality(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThan(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation.C:\Users\tagoo\.nuget\packages\microsoft.dotnet.apicompat\6.0.0-beta.21614.2\build\Microsoft.DotNet.ApiCompat.targets(145,5): error : MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThanOrEqual(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Modulus(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Multiply(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Subtraction(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_UnaryNegation(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_UnaryPlus(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.ReadOnlySpan<System.Char>, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String, System.Globalization.NumberStyles)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.PositiveInfinity.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.Size.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Runtime.InteropServices.NFloat.ToString(System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Runtime.InteropServices.NFloat.ToString(System.String)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Runtime.InteropServices.NFloat.ToString(System.String, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryFormat(System.Span<System.Char>, System.Int32, System.ReadOnlySpan<System.Char>, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.ReadOnlySpan<System.Char>, System.Globalization.NumberStyles, System.IFormatProvider, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.ReadOnlySpan<System.Char>, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.String, System.Globalization.NumberStyles, System.IFormatProvider, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.String, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_Equality(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Explicit(System.Decimal)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThan(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThanOrEqual(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +Total Issues: 85 diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs index c2311afae70..b56ee77c890 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs @@ -15,36 +15,36 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void Ctor_Empty() { - NFloat value = new NFloat(); - Assert.Equal(0, value.Value); + NFloat result = new NFloat(); + Assert.Equal(0, result.Value); } [Fact] public void Ctor_Float() { - NFloat value = new NFloat(42.0f); - Assert.Equal(42.0, value.Value); + NFloat result = new NFloat(42.0f); + Assert.Equal(42.0, result.Value); } [Fact] public void Ctor_Double() { - NFloat value = new NFloat(42.0); - Assert.Equal(42.0, value.Value); + NFloat result = new NFloat(42.0); + Assert.Equal(42.0, result.Value); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is32BitProcess))] public void Ctor_Double_OutOfRange() { - NFloat value = new NFloat(double.MaxValue); - Assert.Equal((double)(float)double.MaxValue, value.Value); + NFloat result = new NFloat(double.MaxValue); + Assert.Equal(float.PositiveInfinity, result.Value); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] public void Ctor_Double_LargeValue() { - NFloat value = new NFloat(double.MaxValue); - Assert.Equal(double.MaxValue, value.Value); + NFloat result = new NFloat(double.MaxValue); + Assert.Equal(double.MaxValue, result.Value); } public static IEnumerable<object[]> EqualsData() @@ -83,7 +83,6 @@ namespace System.Runtime.InteropServices.Tests [InlineData(0.0f)] [InlineData(4567.0f)] [InlineData(4567.89101f)] - [InlineData(float.NaN)] public static void ToStringTest64(float value) { @@ -116,5 +115,805 @@ namespace System.Runtime.InteropServices.Tests #pragma warning restore xUnit2000 Assert.Equal(size, Marshal.SizeOf<NFloat>()); } + +#if FEATURE_NFLOAT + [Fact] + public void Epsilon() + { + NFloat result = NFloat.Epsilon; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.Epsilon, result.Value); + } + else + { + Assert.Equal(float.Epsilon, result.Value); + } + } + + [Fact] + public void MaxValue() + { + NFloat result = NFloat.MaxValue; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.MaxValue, result.Value); + } + else + { + Assert.Equal(float.MaxValue, result.Value); + } + } + + [Fact] + public void MinValue() + { + NFloat result = NFloat.MinValue; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.MinValue, result.Value); + } + else + { + Assert.Equal(float.MinValue, result.Value); + } + } + + [Fact] + public void NaN() + { + NFloat result = NFloat.NaN; + Assert.True(double.IsNaN(result.Value)); + } + + [Fact] + public void NegativeInfinity() + { + NFloat result = NFloat.NegativeInfinity; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.NegativeInfinity, result.Value); + } + else + { + Assert.Equal(float.NegativeInfinity, result.Value); + } + } + + [Fact] + public void PositiveInfinity() + { + NFloat result = NFloat.PositiveInfinity; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.PositiveInfinity, result.Value); + } + else + { + Assert.Equal(float.PositiveInfinity, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_UnaryPlus(float value) + { + NFloat result = +(new NFloat(value)); + Assert.Equal(+value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_UnaryNegation(float value) + { + NFloat result = -(new NFloat(value)); + Assert.Equal(-value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_Decrement(float value) + { + NFloat result = new NFloat(value); + --result; + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)value - 1, result.Value); + } + else + { + Assert.Equal(value - 1, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_Increment(float value) + { + NFloat result = new NFloat(value); + ++result; + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)value + 1, result.Value); + } + else + { + Assert.Equal(value + 1, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + public static void op_Addition(float left, float right) + { + NFloat result = new NFloat(left) + new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left + right, result.Value); + } + else + { + Assert.Equal(left + right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + public static void op_Subtraction(float left, float right) + { + NFloat result = new NFloat(left) - new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left - right, result.Value); + } + else + { + Assert.Equal(left - right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + public static void op_Multiply(float left, float right) + { + NFloat result = new NFloat(left) * new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left * right, result.Value); + } + else + { + Assert.Equal(left * right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + public static void op_Division(float left, float right) + { + NFloat result = new NFloat(left) / new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left / right, result.Value); + } + else + { + Assert.Equal(left / right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + public static void op_Modulus(float left, float right) + { + NFloat result = new NFloat(left) % new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left % right, result.Value); + } + else + { + Assert.Equal(left % right, result.Value); + } + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_Equality(float left, float right) + { + bool result = new NFloat(left) == new NFloat(right); + Assert.Equal(left == right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_Inequality(float left, float right) + { + bool result = new NFloat(left) != new NFloat(right); + Assert.Equal(left != right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_GreaterThan(float left, float right) + { + bool result = new NFloat(left) > new NFloat(right); + Assert.Equal(left > right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_GreaterThanOrEqual(float left, float right) + { + bool result = new NFloat(left) >= new NFloat(right); + Assert.Equal(left >= right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_LessThan(float left, float right) + { + bool result = new NFloat(left) < new NFloat(right); + Assert.Equal(left < right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_LessThanOrEqual(float left, float right) + { + bool result = new NFloat(left) <= new NFloat(right); + Assert.Equal(left <= right, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void DoubleToNFloat(float value) + { + NFloat result = (NFloat)(double)value; + + if (Environment.Is64BitProcess) + { + Assert.Equal(value, result.Value); + } + else + { + Assert.Equal((float)value, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToByte(float value) + { + byte result = (byte)new NFloat(value); + Assert.Equal((byte)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToChar(float value) + { + char result = (char)new NFloat(value); + Assert.Equal((char)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToDecimal(float value) + { + decimal result = (decimal)new NFloat(value); + + if (Environment.Is64BitProcess) + { + Assert.Equal((decimal)(double)value, result); + } + else + { + Assert.Equal((decimal)value, result); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToInt16(float value) + { + short result = (short)new NFloat(value); + Assert.Equal((short)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToInt32(float value) + { + int result = (int)new NFloat(value); + Assert.Equal((int)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToInt64(float value) + { + long result = (long)new NFloat(value); + Assert.Equal((long)value, result); + } + + [Theory] + [InlineData(-4567.0f, Skip = "https://github.com/dotnet/runtime/issues/64386")] + [InlineData(-4567.89101f, Skip = "https://github.com/dotnet/runtime/issues/64386")] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToIntPtr(float value) + { + nint result = (nint)new NFloat(value); + Assert.Equal((nint)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToSByte(float value) + { + sbyte result = (sbyte)new NFloat(value); + Assert.Equal((sbyte)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToSingle(float value) + { + float result = (float)new NFloat(value); + Assert.Equal(value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUInt16(float value) + { + ushort result = (ushort)new NFloat(value); + Assert.Equal((ushort)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUInt32(float value) + { + uint result = (uint)new NFloat(value); + Assert.Equal((uint)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUInt64(float value) + { + ulong result = (ulong)new NFloat(value); + Assert.Equal((ulong)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUIntPtr(float value) + { + nuint result = (nuint)new NFloat(value); + Assert.Equal((nuint)value, result); + } + + [Theory] + [InlineData((byte)0)] + [InlineData((byte)5)] + [InlineData((byte)42)] + [InlineData((byte)127)] + [InlineData((byte)255)] + public void ByteToNFloat(byte value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData('A')] + [InlineData('B')] + [InlineData('C')] + [InlineData('D')] + [InlineData('E')] + public void CharToNFloat(char value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((short)-255)] + [InlineData((short)-127)] + [InlineData((short)0)] + [InlineData((short)127)] + [InlineData((short)255)] + public void Int16ToNFloat(short value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData(-255)] + [InlineData(-127)] + [InlineData(0)] + [InlineData(127)] + [InlineData(255)] + public void Int32ToNFloat(int value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((long)-255)] + [InlineData((long)-127)] + [InlineData((long)0)] + [InlineData((long)127)] + [InlineData((long)255)] + public void Int64ToNFloat(long value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((int)-255)] + [InlineData((int)-127)] + [InlineData((int)0)] + [InlineData((int)127)] + [InlineData((int)255)] + public void IntPtrToNFloat(int value) + { + NFloat result = (nint)value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((sbyte)-127)] + [InlineData((sbyte)-63)] + [InlineData((sbyte)0)] + [InlineData((sbyte)63)] + [InlineData((sbyte)127)] + public void SByteToNFloat(sbyte value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void SingleToNFloat(float value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((ushort)0)] + [InlineData((ushort)5)] + [InlineData((ushort)42)] + [InlineData((ushort)127)] + [InlineData((ushort)255)] + public void UInt16ToNFloat(ushort value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((uint)0)] + [InlineData((uint)5)] + [InlineData((uint)42)] + [InlineData((uint)127)] + [InlineData((uint)255)] + public void UInt32ToNFloat(uint value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((ulong)0)] + [InlineData((ulong)5)] + [InlineData((ulong)42)] + [InlineData((ulong)127)] + [InlineData((ulong)255)] + public void UInt64ToNFloat(ulong value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((uint)0)] + [InlineData((uint)5)] + [InlineData((uint)42)] + [InlineData((uint)127)] + [InlineData((uint)255)] + public void UIntPtrToNFloat(uint value) + { + NFloat result = (nuint)value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToDouble(float value) + { + double result = new NFloat(value); + Assert.Equal(value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsFinite(float value) + { + bool result = NFloat.IsFinite(value); + Assert.Equal(float.IsFinite(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsInfinity(float value) + { + bool result = NFloat.IsInfinity(value); + Assert.Equal(float.IsInfinity(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNaN(float value) + { + bool result = NFloat.IsNaN(value); + Assert.Equal(float.IsNaN(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNegative(float value) + { + bool result = NFloat.IsNegative(value); + Assert.Equal(float.IsNegative(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNegativeInfinity(float value) + { + bool result = NFloat.IsNegativeInfinity(value); + Assert.Equal(float.IsNegativeInfinity(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNormal(float value) + { + bool result = NFloat.IsNormal(value); + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.IsNormal(value), result); + } + else + { + Assert.Equal(float.IsNormal(value), result); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsPositiveInfinity(float value) + { + bool result = NFloat.IsPositiveInfinity(value); + Assert.Equal(float.IsPositiveInfinity(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsSubnormal(float value) + { + bool result = NFloat.IsSubnormal(value); + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.IsSubnormal(value), result); + } + else + { + Assert.Equal(float.IsSubnormal(value), result); + } + } +#endif // FEATURE_NFLOAT } } diff --git a/src/libraries/testPackages/packageSettings/System.Runtime.InteropServices.NFloat.Internal/settings.targets b/src/libraries/testPackages/packageSettings/System.Runtime.InteropServices.NFloat.Internal/settings.targets new file mode 100644 index 00000000000..eaa4cdfb1bb --- /dev/null +++ b/src/libraries/testPackages/packageSettings/System.Runtime.InteropServices.NFloat.Internal/settings.targets @@ -0,0 +1,5 @@ +<Project> + <PropertyGroup> + <SkipVerifyRuntime>true</SkipVerifyRuntime> + </PropertyGroup> +</Project>
\ No newline at end of file |