Slightly change some BlitSpan methods

This commit is contained in:
Alex Barney 2019-11-22 18:41:11 -06:00
parent be2c4d3959
commit a7c733f96c

View file

@ -21,7 +21,7 @@ namespace LibHac.Common
/// <summary> /// <summary>
/// A reference to the first element in this collection. /// A reference to the first element in this collection.
/// </summary> /// </summary>
public ref T Value => ref _buffer[0]; public ref T Value => ref MemoryMarshal.GetReference(_buffer);
/// <summary> /// <summary>
/// A reference to the element at index <paramref name="index"/>. /// A reference to the element at index <paramref name="index"/>.
@ -84,8 +84,7 @@ namespace LibHac.Common
/// <returns>A byte span representation of the element.</returns> /// <returns>A byte span representation of the element.</returns>
public Span<byte> GetByteSpan(int elementIndex) public Span<byte> GetByteSpan(int elementIndex)
{ {
Span<T> element = _buffer.Slice(elementIndex, 1); return SpanHelpers.AsByteSpan(ref _buffer[elementIndex]);
return MemoryMarshal.Cast<T, byte>(element);
} }
/// <summary> /// <summary>