Investigate Spans
nickbabcock opened this issue · 2 comments
nickbabcock commented
I'm afraid that grabbing the next 64bits in a Span won't be as efficient as:
ulong Fetch64(byte* p) => *(ulong*)p
Even though a Span is a contiguous area of memory, I'm not sure if there's an operation that is as similarly optimized as pointers.
nickbabcock commented
Actually, it may be doable.
- Wait for .NET Core 2.1
- Use
MemoryMarshal.GetReference
, to get a reference to the first element of the span. - Unsafe.As cast from reference to pointer.
- Use the
byte*
methods
nickbabcock commented
Added in 0.6