Browse Source

watch SUPPORTS_CREATESPAN

pull/1901/head
Anton Firszov 4 years ago
parent
commit
bce450ce25
  1. 5
      src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs

5
src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs

@ -252,10 +252,15 @@ namespace SixLabors.ImageSharp.Memory
{
case SpanCacheMode.SingleArray:
{
#if SUPPORTS_CREATESPAN
ref byte b0 = ref MemoryMarshal.GetReference<byte>(this.memoryGroupSpanCache.SingleArray);
ref T e0 = ref Unsafe.As<byte, T>(ref b0);
e0 = ref Unsafe.Add(ref e0, y * width);
return MemoryMarshal.CreateSpan(ref e0, width);
#else
return MemoryMarshal.Cast<byte, T>(this.memoryGroupSpanCache.SingleArray).Slice(y * width, width);
#endif
}
case SpanCacheMode.SinglePointer:

Loading…
Cancel
Save