For those who Int128 on the legitimacy of Int128 / UInt128 in .NET, some work on UInt128 hardware embedded UInt128 and 128-bit mathematics in .NET was promoted by the MS Machine Learning initiative. There is a NuGet package here, which currently provides some facilities for regular 128-bit integer operations as long / ulong pairs, and may include hardware features in the future where available. Meanwhile, they provide a cross-platform library (CpuMathNative) that runs Div64 ("Divide the 128-bit value by lo and hi by den .") And Mul64 (" Mul64 two 64-bit values ββto get a 128-bit result." ") , as well as MulDiv64 ("Multiply a and b and divide by den ", returning the quotient and putting the remainder in rem .), 128-bit v. 128-bit DivRound , Add , Sub , LessThan .
From this, you can easily create an Int128 and UInt128 and, possibly, pass it in hardware registers with careful use of the Vector128 implementation ( System.Runtime.Intrinsics ).
Although as a footnote, BigMath.PCL is still a good paste solution.
TylerY86 Jan 12 '19 at 23:06 2019-01-12 23:06
source share