Merge pull request #491 from Sergio0694/dev/net-native-assertions

Use Unsafe.As to reinterpret ImmutableArray<T> values
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2023-03-04 23:46:03 +01:00
コミット 60ea451447
2ファイル変更
+4 -4

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

@@ -30,7 +30,7 @@ internal struct D2D1ImmutableArrayResourceTextureDescriptionsLoader : ID2D1Resou
}
/// <inheritdoc/>
unsafe void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan<byte> data)
void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan<byte> data)
{
if (data.IsEmpty)
{
@@ -47,7 +47,7 @@ internal struct D2D1ImmutableArrayResourceTextureDescriptionsLoader : ID2D1Resou
indices[i] = descriptions[i].Index;
}
this.indices = *(ImmutableArray<int>*)&indices;
this.indices = Unsafe.As<int[], ImmutableArray<int>>(ref indices);
}
}
}
+2 -2
ファイルの表示
@@ -208,7 +208,7 @@ partial class PixelShaderEffect<T>
/// Gets the collection of valid indices for the current effect.
/// </summary>
/// <returns>The collection of valid indices for the current effect.</returns>
private static unsafe ImmutableArray<int> GetIndices()
private static ImmutableArray<int> GetIndices()
{
int inputCount = D2D1PixelShader.GetInputCount<T>();
@@ -224,7 +224,7 @@ partial class PixelShaderEffect<T>
indices[i] = i;
}
return *(ImmutableArray<int>*)&indices;
return Unsafe.As<int[], ImmutableArray<int>>(ref indices);
}
}
}