Browse Source

Remove unused FetchVector helper

This doesn't account for alignment and we're getting a native constructor soon.

https://github.com/dotnet/corefx/issues/24343
af/merge-core
Jason Nelson 8 years ago
parent
commit
997ca49679
  1. 15
      src/ImageSharp/Memory/SpanHelper.cs
  2. 15
      tests/ImageSharp.Tests/Memory/SpanUtilityTests.cs

15
src/ImageSharp/Memory/SpanHelper.cs

@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace SixLabors.ImageSharp.Memory
{
@ -13,19 +11,6 @@ namespace SixLabors.ImageSharp.Memory
/// </summary>
internal static class SpanHelper
{
/// <summary>
/// Fetches a <see cref="Vector{T}"/> from the beginning of the span.
/// </summary>
/// <typeparam name="T">The value type</typeparam>
/// <param name="span">The span to fetch the vector from</param>
/// <returns>A <see cref="Vector{T}"/> reference to the beginning of the span</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref Vector<T> FetchVector<T>(this Span<T> span)
where T : struct
{
return ref Unsafe.As<T, Vector<T>>(ref MemoryMarshal.GetReference(span));
}
/// <summary>
/// Copy 'count' number of elements of the same type from 'source' to 'dest'
/// </summary>

15
tests/ImageSharp.Tests/Memory/SpanUtilityTests.cs

@ -26,21 +26,6 @@ namespace SixLabors.ImageSharp.Tests.Memory
Assert.True(Unsafe.AreSame(ref a, ref bb), "References are not same!");
}
}
[Fact]
public void FetchVector()
{
float[] stuff = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
var span = new Span<float>(stuff);
ref Vector<float> v = ref span.FetchVector();
Assert.Equal(0, v[0]);
Assert.Equal(1, v[1]);
Assert.Equal(2, v[2]);
Assert.Equal(3, v[3]);
}
public class SpanHelper_Copy
{

Loading…
Cancel
Save