Merge pull request #386 from Sergio0694/dev/remove-leftover-polyfills
Remove leftover MemoryMarshal polyfills
このコミットが含まれているのは:
4ファイル変更
-75
検索条件に一致するファイルはありません
@@ -9,7 +9,6 @@
|
||||
<Import_RootNamespace>ComputeSharp.Core.NetStandard</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\InteropServices\MemoryMarshal.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime.CompilerServices\InterpolatedStringHandlerArgumentAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime.CompilerServices\InterpolatedStringHandlerAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime.CompilerServices\IsExternalInit.cs" />
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace ComputeSharp.Core.NetStandard.System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// A polyfill type that mirrors some methods from <see cref="MemoryMarshal"/> on .NET 6.
|
||||
/// </summary>
|
||||
internal static class MemoryMarshal
|
||||
{
|
||||
/// <inheritdoc cref="global::System.Runtime.InteropServices.MemoryMarshal.GetReference{T}(Span{T})"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T GetReference<T>(Span<T> span)
|
||||
{
|
||||
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(span);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="global::System.Runtime.InteropServices.MemoryMarshal.GetReference{T}(ReadOnlySpan{T})"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T GetReference<T>(ReadOnlySpan<T> span)
|
||||
{
|
||||
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Span{T}"/> from a given reference.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of reference to wrap.</typeparam>
|
||||
/// <param name="value">The target reference.</param>
|
||||
/// <param name="length">The length of the <see cref="Span{T}"/> to create.</param>
|
||||
/// <returns>A new <see cref="Span{T}"/> wrapping <paramref name="value"/>.</returns>
|
||||
public static unsafe Span<T> CreateSpan<T>(ref T value, int length)
|
||||
{
|
||||
return new(Unsafe.AsPointer(ref value), length);
|
||||
}
|
||||
}
|
||||
@@ -8,20 +8,6 @@ namespace ComputeSharp.NetStandard.System.Runtime.InteropServices;
|
||||
/// </summary>
|
||||
internal static class MemoryMarshal
|
||||
{
|
||||
/// <inheritdoc cref="global::System.Runtime.InteropServices.MemoryMarshal.GetReference{T}(Span{T})"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T GetReference<T>(Span<T> span)
|
||||
{
|
||||
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(span);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="global::System.Runtime.InteropServices.MemoryMarshal.GetReference{T}(ReadOnlySpan{T})"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ref T GetReference<T>(ReadOnlySpan<T> span)
|
||||
{
|
||||
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.
|
||||
@@ -32,16 +18,4 @@ internal static class MemoryMarshal
|
||||
{
|
||||
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(array.AsSpan());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Span{T}"/> from a given reference.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of reference to wrap.</typeparam>
|
||||
/// <param name="value">The target reference.</param>
|
||||
/// <param name="length">The length of the <see cref="Span{T}"/> to create.</param>
|
||||
/// <returns>A new <see cref="Span{T}"/> wrapping <paramref name="value"/>.</returns>
|
||||
public static unsafe Span<T> CreateSpan<T>(ref T value, int length)
|
||||
{
|
||||
return new(Unsafe.AsPointer(ref value), length);
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,7 @@
|
||||
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
|
||||
// Original source is Copyright © Microsoft. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
|
||||
namespace TerraFX.Interop.DirectX
|
||||
{
|
||||
@@ -17,15 +14,6 @@ namespace TerraFX.Interop.DirectX
|
||||
[NativeTypeName("D3D12_CLEAR_VALUE::(anonymous union at C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/d3d12.h:2710:5)")]
|
||||
public _Anonymous_e__Union Anonymous;
|
||||
|
||||
public Span<float> Color
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return MemoryMarshal.CreateSpan(ref Anonymous.Color[0], 4);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
internal unsafe partial struct _Anonymous_e__Union
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする