Skip to content

Instantly share code, notes, and snippets.

@antonfirsov
Created January 29, 2017 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonfirsov/a43391087d5d0e18370b5b1454b51daf to your computer and use it in GitHub Desktop.
Save antonfirsov/a43391087d5d0e18370b5b1454b51daf to your computer and use it in GitHub Desktop.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void CopyColorsTo(Span<byte> buffer, int stride, Block8x8F* tempBlockPtr)
{
this.TransformByteConvetibleColorValuesInto(ref *tempBlockPtr);
float* src = (float*)tempBlockPtr;
for (int i = 0; i < 8; i++)
{
buffer[0] = (byte)src[0];
buffer[1] = (byte)src[1];
buffer[2] = (byte)src[2];
buffer[3] = (byte)src[3];
buffer[4] = (byte)src[4];
buffer[5] = (byte)src[5];
buffer[6] = (byte)src[6];
buffer[7] = (byte)src[7];
if (i < 7)
{
buffer = buffer.Slice(stride);
}
src += 8;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment