I'm trying to prototype an unsigned BigInteger type with fixed byte size. The general idea is to have a struct with a fixed buffer of UInt64 parts.
In order to do addition of those big integers efficiently, I could use a C# equivalent of the _addcarry_u64 intrinsic function, as supported by MSVC or ICC in the C++ world. So far, I unfortunately couldn't find a baked-in equivalent in .NET Core 2.1.
Is there any equivalent in the C# world already (maybe with .NET Core 3.0 intrinsics? I can't test that on my machine unfortunately)?
Alternatively, is there any reasonable way for a custom implementation? The only way I can think of would be to generate Assembly for these instructions, but then again, the only ways I've seen to invoke Assembly at all from C# is via PInvoke, and - to be tested - but I'd strongly suppose the overhead of that will be considerable larger than the performance to be gained from the intrinsic in the first place.
Thanks