As already mentioned within dotnet/runtime#22387 the all-new Span should bring many benefits to BigInteger.
We cannot get grid of unsafe code completely since there are stack-vs-heap paths based on stackalloc, but all the pointer based stuff should gracefully disappear; I think.
I'm interested to dive into this, after the summer or so.
cc @stephentoub
We cannot get grid of unsafe code completely since there are stack-vs-heap paths based on stackalloc
If that's the only need for unsafe, you might be able to. C# may end up supporting stackalloc'ing directly into a Span, in which case it likely would not require using unsafe.
If that's the only need for
unsafe, you might be able to. C# may end up supportingstackalloc'ing directly into aSpan, in which case it likely would not require usingunsafe.
It supports this now.
https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md
C#
Span<byte> stackSpan = stackalloc byte[100];
Marking this as up-for-grabs. Anyone should feel empowered to pick this up and prototype the improvements detailed.
Most helpful comment
It supports this now.
https://github.com/dotnet/corefxlab/blob/master/docs/specs/span.md
C# Span<byte> stackSpan = stackalloc byte[100];