Add .NET Standard 2.0 target to ComputeSharp

Also switch TerraFX.Interop.Windows to shared project
このコミットが含まれているのは:
Sergio Pedri committed 2021-11-16 17:34:01 +01:00
1 親 78f68f7b8c
コミット 06ce524740
66ファイル変更
+1276 -178

検索条件に一致するファイルはありません

@@ -0,0 +1,28 @@
namespace System.Runtime.CompilerServices;
/// <summary>
/// Indicates which arguments to a method involving an interpolated string handler should be passed to that handler.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="InterpolatedStringHandlerArgumentAttribute"/> class.
/// </summary>
/// <param name="argument">The name of the argument that should be passed to the handler.</param>
/// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks>
public InterpolatedStringHandlerArgumentAttribute(string argument) => Arguments = new string[] { argument };
/// <summary>
/// Initializes a new instance of the <see cref="InterpolatedStringHandlerArgumentAttribute"/> class.
/// </summary>
/// <param name="arguments">The names of the arguments that should be passed to the handler.</param>
/// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks>
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) => Arguments = arguments;
/// <summary>
/// Gets the names of the arguments that should be passed to the handler.
/// </summary>
/// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks>
public string[] Arguments { get; }
}
@@ -0,0 +1,9 @@
namespace System.Runtime.CompilerServices;
/// <summary>
/// Indicates the attributed type is to be used as an interpolated string handler.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
public sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
@@ -0,0 +1,27 @@
namespace System.Runtime.CompilerServices;
/// <summary>
/// Used to indicate to the compiler that the <c>.locals init</c>
/// flag should not be set in method headers.
/// </summary>
/// <remarks>
/// This attribute is unsafe because it may reveal uninitialized memory to
/// the application in certain instances (e.g., reading from uninitialized
/// stackalloc'd memory). If applied to a method directly, the attribute
/// applies to that method and all nested functions (lambdas, local
/// functions) below it. If applied to a type or module, it applies to all
/// methods nested inside. This attribute is intentionally not permitted on
/// assemblies. Use at the module level instead to apply to multiple type
/// declarations.
/// </remarks>
[AttributeUsage(AttributeTargets.Module
| AttributeTargets.Class
| AttributeTargets.Struct
| AttributeTargets.Interface
| AttributeTargets.Constructor
| AttributeTargets.Method
| AttributeTargets.Property
| AttributeTargets.Event, Inherited = false)]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
+11
ファイルの表示
@@ -22,6 +22,17 @@ internal static class MemoryMarshal
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(span);
}
/// <summary>
/// Returns a reference to the 0th element of <paramref name="array"/>. If the array is empty, returns a reference
/// to where the 0th element would have been stored. Such a reference may be used for pinning but must never be dereferenced.
/// </summary>
/// <exception cref="NullReferenceException"><paramref name="array"/> is <see langword="null"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref T GetArrayDataReference<T>(T[] array)
{
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(array.AsSpan());
}
/// <summary>
/// Creates a new <see cref="Span{T}"/> from a given reference.
/// </summary>