358 instantiations of UInt128
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129return new UInt128(hash.High64, hash.Low64); 214return new UInt128(current.High64, current.Low64);
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHash128.cs (2)
127return new UInt128(hash.High64, hash.Low64); 212return new UInt128(current.High64, current.Low64);
Microsoft.CodeAnalysis (2)
Hashing\XxHash128.cs (2)
129return new UInt128(hash.High64, hash.Low64); 214return new UInt128(current.High64, current.Low64);
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129return new UInt128(hash.High64, hash.Low64); 214return new UInt128(current.High64, current.Low64);
System.IO.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
125return new UInt128(hash.High64, hash.Low64); 210return new UInt128(current.High64, current.Low64);
System.Private.CoreLib (340)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (1)
189return new UInt128(
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.Int128.cs (1)
35value /= new UInt128(0x5, 0x6BC7_5E2D_6310_0000); // value /= 1e20
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (2)
1749UInt128 mantissa = new UInt128(high, low64); 1823return new UInt128((exponent == DEC_SCALE_MAX) ? 2u : 0u, pow5[exponent]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (2)
422public static explicit operator UInt128(Int128 value) => new UInt128(value._upper, value._lower); 435return new UInt128(value._upper, value._lower);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
285return new UInt128(high, low);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (2)
1356return new UInt128(((ulong)_blocks[3] << 32) + _blocks[2], ((ulong)(_blocks[1]) << 32) + _blocks[0]); 1361return new UInt128((ulong)_blocks[2], ((ulong)_blocks[1] << 32) + _blocks[0]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128.cs (2)
551return new UInt128((ulong)value._sign << 32, 0); 596return new UInt128(currentDigit, lowWord);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Conversions.cs (1)
158UInt128 fraction = new UInt128(value._hi, value._lo);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128PiTrig.cs (1)
95UInt128 significand = new UInt128(value._hi, value._lo);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Trig.cs (4)
178UInt128 p = (UInt128)a * b + new UInt128(addHi, addLo); 186UInt128 addend = new UInt128(addHi, addLo); 196UInt128 prod = (UInt128)a * b + new UInt128(carryIn, 0); 197UInt128 addend = new UInt128(addHi, addLo);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (1)
2837UInt128 divisor = new UInt128(0, 10_000_000_000_000_000_000);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Rounding.cs (1)
145: TryGetFloorAndMidpoint(new UInt128(high, low), shift, DoubleIntegerBoundaryLog2, out floor, out midpointComparison, out hasRemainder);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal128.cs (225)
40private static UInt128 PositiveInfinityValue => new UInt128(upper: 0x7800_0000_0000_0000, lower: 0); 41private static UInt128 NegativeInfinityValue => new UInt128(upper: 0xF800_0000_0000_0000, lower: 0); 44private static UInt128 ZeroValue => new UInt128(0x3040_0000_0000_0000, 0); 45private static UInt128 NegativeZeroValue => new UInt128(0xB040_0000_0000_0000, 0); 47private static UInt128 OneValue => new UInt128(0x3040_0000_0000_0000, 1); 48private static UInt128 NegativeOneValue => new UInt128(0xB040_0000_0000_0000, 1); 50private static UInt128 EValue => new UInt128(0x2FFE_8605_8A4B_F4DE, 0x4E90_6ACC_B26A_BB56); // +2.718281828459045235360287471352662 51private static UInt128 PiValue => new UInt128(0x2FFE_9AE4_7957_96A7, 0xBABE_5564_E6F3_9F8F); // +3.141592653589793238462643383279503 52private static UInt128 TauValue => new UInt128(0x2FFF_35C8_F2AF_2D4F, 0x757C_AAC9_CDE7_3F1E); // +6.283185307179586476925286766559006 53private static UInt128 QuietNaNValue => new UInt128(0xFC00_0000_0000_0000, 0); 54private static UInt128 NaNPayloadMask => new UInt128(0x0000_3FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 221var current = new UInt128(_upper, _lower); 222var another = new UInt128(other._upper, other._lower); 229var current = new UInt128(_upper, _lower); 230var another = new UInt128(other._upper, other._lower); 247return Number.GetDecimalIeee754HashCode<Decimal128, UInt128>(new UInt128(_upper, _lower)); 254public static UInt128 EncodeBinary(Decimal128 x) => new UInt128(x._upper, x._lower); 266public static UInt128 EncodeDecimal(Decimal128 x) => Number.EncodeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 279return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), null, NumberFormatInfo.CurrentInfo); 287return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), format, NumberFormatInfo.CurrentInfo); 295return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), null, NumberFormatInfo.GetInstance(provider)); 303return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider)); 309return Number.TryFormatDecimalIeee754<Decimal128, UInt128, char>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), destination, out charsWritten); 315return Number.TryFormatDecimalIeee754<Decimal128, UInt128, byte>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), utf8Destination, out bytesWritten); 333UInt128 result = Number.AddDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), OneValue); 342UInt128 result = Number.SubtractDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), OneValue); 352UInt128 result = Number.AddDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 362UInt128 result = Number.SubtractDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 372UInt128 result = Number.MultiplyDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 382UInt128 result = Number.DivideDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 392UInt128 result = Number.RemainderDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 433public static explicit operator byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, byte>(new UInt128(value._upper, value._lower), isChecked: false); 439public static explicit operator checked byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, byte>(new UInt128(value._upper, value._lower), isChecked: true); 445public static explicit operator sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, sbyte>(new UInt128(value._upper, value._lower), isChecked: false); 452public static explicit operator checked sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, sbyte>(new UInt128(value._upper, value._lower), isChecked: true); 457public static explicit operator char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: false); 463public static explicit operator checked char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: true); 468public static explicit operator short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, short>(new UInt128(value._upper, value._lower), isChecked: false); 474public static explicit operator checked short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, short>(new UInt128(value._upper, value._lower), isChecked: true); 480public static explicit operator ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: false); 487public static explicit operator checked ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: true); 492public static explicit operator int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, int>(new UInt128(value._upper, value._lower), isChecked: false); 498public static explicit operator checked int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, int>(new UInt128(value._upper, value._lower), isChecked: true); 504public static explicit operator uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, uint>(new UInt128(value._upper, value._lower), isChecked: false); 511public static explicit operator checked uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, uint>(new UInt128(value._upper, value._lower), isChecked: true); 516public static explicit operator nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nint>(new UInt128(value._upper, value._lower), isChecked: false); 522public static explicit operator checked nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nint>(new UInt128(value._upper, value._lower), isChecked: true); 528public static explicit operator nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nuint>(new UInt128(value._upper, value._lower), isChecked: false); 535public static explicit operator checked nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nuint>(new UInt128(value._upper, value._lower), isChecked: true); 540public static explicit operator long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, long>(new UInt128(value._upper, value._lower), isChecked: false); 546public static explicit operator checked long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, long>(new UInt128(value._upper, value._lower), isChecked: true); 552public static explicit operator ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ulong>(new UInt128(value._upper, value._lower), isChecked: false); 559public static explicit operator checked ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ulong>(new UInt128(value._upper, value._lower), isChecked: true); 564public static explicit operator Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, Int128>(new UInt128(value._upper, value._lower), isChecked: false); 570public static explicit operator checked Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, Int128>(new UInt128(value._upper, value._lower), isChecked: true); 576public static explicit operator UInt128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, UInt128>(new UInt128(value._upper, value._lower), isChecked: false); 583public static explicit operator checked UInt128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, UInt128>(new UInt128(value._upper, value._lower), isChecked: true); 588public static explicit operator Half(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, Half>(new UInt128(value._upper, value._lower)); 593public static explicit operator float(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, float>(new UInt128(value._upper, value._lower)); 598public static explicit operator double(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, double>(new UInt128(value._upper, value._lower)); 604public static explicit operator decimal(Decimal128 value) => Number.ConvertDecimalIeee754ToDecimal<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 681return Number.EqualsDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 699return Number.LessThanDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 708return Number.GreaterThanDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 717return Number.LessThanOrEqualDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 726return Number.GreaterThanOrEqualDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 795public static Decimal128 Ceiling(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToPositiveInfinity)); 806public static Decimal128 Floor(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToNegativeInfinity)); 809public static Decimal128 Round(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToEven)); 812public static Decimal128 Round(Decimal128 x, int digits) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), digits, MidpointRounding.ToEven)); 815public static Decimal128 Round(Decimal128 x, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, mode)); 818public static Decimal128 Round(Decimal128 x, int digits, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), digits, mode)); 821public static Decimal128 Truncate(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToZero)); 829int exponent = Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).UnbiasedExponent; 850if (BinaryPrimitives.TryWriteInt32BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).UnbiasedExponent)) 863if (BinaryPrimitives.TryWriteInt32LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).UnbiasedExponent)) 876if (BinaryPrimitives.TryWriteUInt128BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).Significand)) 889if (BinaryPrimitives.TryWriteUInt128LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).Significand)) 904public static Decimal128 Acos(Decimal128 x) => new Decimal128(Number.AcosDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 907public static Decimal128 AcosPi(Decimal128 x) => new Decimal128(Number.AcosPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 910public static Decimal128 Acosh(Decimal128 x) => new Decimal128(Number.AcoshDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 913public static Decimal128 Asin(Decimal128 x) => new Decimal128(Number.AsinDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 916public static Decimal128 AsinPi(Decimal128 x) => new Decimal128(Number.AsinPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 919public static Decimal128 Asinh(Decimal128 x) => new Decimal128(Number.AsinhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 922public static Decimal128 Atan(Decimal128 x) => new Decimal128(Number.AtanDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 925public static Decimal128 Atan2(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2DecimalIeee754<Decimal128, UInt128>(new UInt128(y._upper, y._lower), new UInt128(x._upper, x._lower))); 928public static Decimal128 Atan2Pi(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2PiDecimalIeee754<Decimal128, UInt128>(new UInt128(y._upper, y._lower), new UInt128(x._upper, x._lower))); 931public static Decimal128 AtanPi(Decimal128 x) => new Decimal128(Number.AtanPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 934public static Decimal128 Atanh(Decimal128 x) => new Decimal128(Number.AtanhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 937public static Decimal128 BitDecrement(Decimal128 x) => new Decimal128(Number.BitDecrementDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 940public static Decimal128 BitIncrement(Decimal128 x) => new Decimal128(Number.BitIncrementDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 943public static Decimal128 Cbrt(Decimal128 x) => new Decimal128(Number.CbrtDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 946public static Decimal128 Cos(Decimal128 x) => new Decimal128(Number.CosDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 949public static Decimal128 CosPi(Decimal128 x) => new Decimal128(Number.CosPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 952public static Decimal128 Cosh(Decimal128 x) => new Decimal128(Number.CoshDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 955public static Decimal128 Exp(Decimal128 x) => new Decimal128(Number.ExpDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 958public static Decimal128 Exp10(Decimal128 x) => new Decimal128(Number.Exp10DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 961public static Decimal128 Exp10M1(Decimal128 x) => new Decimal128(Number.Exp10M1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 964public static Decimal128 Exp2(Decimal128 x) => new Decimal128(Number.Exp2DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 967public static Decimal128 Exp2M1(Decimal128 x) => new Decimal128(Number.Exp2M1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 970public static Decimal128 ExpM1(Decimal128 x) => new Decimal128(Number.ExpM1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 973public static Decimal128 FusedMultiplyAdd(Decimal128 left, Decimal128 right, Decimal128 addend) => new Decimal128(Number.FusedMultiplyAddDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower), new UInt128(addend._upper, addend._lower))); 976public static Decimal128 Hypot(Decimal128 x, Decimal128 y) => new Decimal128(Number.HypotDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 979public static Decimal128 Ieee754Remainder(Decimal128 left, Decimal128 right) => new Decimal128(Number.Ieee754RemainderDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower))); 982public static int ILogB(Decimal128 x) => Number.ILogBDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 988public static Decimal128 Log(Decimal128 x) => new Decimal128(Number.LogDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 991public static Decimal128 Log(Decimal128 x, Decimal128 newBase) => new Decimal128(Number.LogDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(newBase._upper, newBase._lower))); 994public static Decimal128 Log10(Decimal128 x) => new Decimal128(Number.Log10DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 997public static Decimal128 Log10P1(Decimal128 x) => new Decimal128(Number.Log10P1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1000public static Decimal128 Log2(Decimal128 x) => new Decimal128(Number.Log2DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1003public static Decimal128 Log2P1(Decimal128 x) => new Decimal128(Number.Log2P1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1006public static Decimal128 LogP1(Decimal128 x) => new Decimal128(Number.LogP1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1009public static Decimal128 Pow(Decimal128 x, Decimal128 y) => new Decimal128(Number.PowDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1018public static Decimal128 RootN(Decimal128 x, int n) => new Decimal128(Number.RootNDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), n)); 1021public static Decimal128 ScaleB(Decimal128 x, int n) => new Decimal128(Number.ScaleBDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), n)); 1024public static Decimal128 Sin(Decimal128 x) => new Decimal128(Number.SinDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1029(UInt128 sin, UInt128 cos) = Number.SinCosDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 1036(UInt128 sin, UInt128 cos) = Number.SinCosPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 1041public static Decimal128 SinPi(Decimal128 x) => new Decimal128(Number.SinPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1044public static Decimal128 Sinh(Decimal128 x) => new Decimal128(Number.SinhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1047public static Decimal128 Sqrt(Decimal128 x) => new Decimal128(Number.SqrtDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1050public static Decimal128 Tan(Decimal128 x) => new Decimal128(Number.TanDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1053public static Decimal128 TanPi(Decimal128 x) => new Decimal128(Number.TanPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1056public static Decimal128 Tanh(Decimal128 x) => new Decimal128(Number.TanhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1062public static Decimal128 Quantize(Decimal128 x, Decimal128 y) => new Decimal128(Number.QuantizeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1067public static Decimal128 GetQuantum(Decimal128 x) => new Decimal128(Number.QuantumDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1073public static bool HaveSameQuantum(Decimal128 x, Decimal128 y) => Number.SameQuantumDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)); 1078public static Decimal128 Abs(Decimal128 value) => new Decimal128(Number.AbsDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower))); 1123public static bool IsInteger(Decimal128 value) => Number.IsIntegerDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1128public static bool IsEvenInteger(Decimal128 value) => Number.IsEvenIntegerDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1133public static bool IsOddInteger(Decimal128 value) => Number.IsOddIntegerDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1138public static bool IsNormal(Decimal128 value) => Number.IsNormalDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1143public static bool IsSubnormal(Decimal128 value) => Number.IsSubnormalDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1149public static Decimal128 MaxMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1155public static Decimal128 MaxMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1161public static Decimal128 MinMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1167public static Decimal128 MinMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1210public static Decimal128 CopySign(Decimal128 value, Decimal128 sign) => new Decimal128(Number.CopySignDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), new UInt128(sign._upper, sign._lower))); 1216public static Decimal128 Max(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1222public static Decimal128 MaxNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNativeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1228public static Decimal128 MaxNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1234public static Decimal128 Min(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1240public static Decimal128 MinNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNativeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1246public static Decimal128 MinNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1252public static int Sign(Decimal128 value) => Number.SignDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1258static bool INumberBase<Decimal128>.IsCanonical(Decimal128 value) => Number.IsCanonicalDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), nanReservedMask: new UInt128(0x01FF_C000_0000_0000, 0x0000_0000_0000_0000), nanPayloadMask: NaNPayloadMask, maxNaNPayload: new UInt128(0x0000_314D_C644_8D93, 0x38C1_5B09_FFFF_FFFF)); 1267static bool INumberBase<Decimal128>.IsZero(Decimal128 value) => Number.IsZeroDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1702new UInt128(0, 1), 1703new UInt128(0, 10), 1704new UInt128(0, 100), 1705new UInt128(0, 1000), 1706new UInt128(0, 10000), 1707new UInt128(0, 100000), 1708new UInt128(0, 1000000), 1709new UInt128(0, 10000000), 1710new UInt128(0, 100000000), 1711new UInt128(0, 1000000000), 1712new UInt128(0, 10000000000), 1713new UInt128(0, 100000000000), 1714new UInt128(0, 1000000000000), 1715new UInt128(0, 10000000000000), 1716new UInt128(0, 100000000000000), 1717new UInt128(0, 1000000000000000), 1718new UInt128(0, 10000000000000000), 1719new UInt128(0, 100000000000000000), 1720new UInt128(0, 1000000000000000000), 1721new UInt128(0, 10000000000000000000), 1722new UInt128(5, 7766279631452241920), 1723new UInt128(54, 3875820019684212736), 1724new UInt128(542, 1864712049423024128), 1725new UInt128(5421, 200376420520689664), 1726new UInt128(54210, 2003764205206896640), 1727new UInt128(542101, 1590897978359414784), 1728new UInt128(5421010, 15908979783594147840), 1729new UInt128(54210108, 11515845246265065472), 1730new UInt128(542101086, 4477988020393345024), 1731new UInt128(5421010862, 7886392056514347008), 1732new UInt128(54210108624, 5076944270305263616), 1733new UInt128(542101086242, 13875954555633532928), 1734new UInt128(5421010862427, 9632337040368467968), 1735new UInt128(54210108624275, 4089650035136921600), 1736new UInt128(542101086242752, 4003012203950112768), 1791static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MostSignificantBitOfSignificandMask => new UInt128(0x0002_0000_0000_0000, 0); 1793static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NaNMask => new UInt128(NaNMaskUpper, 0); 1795static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.SNaNMask => new UInt128(SNaNMaskUpper, 0); 1799static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.SignMask => new UInt128(SignMaskUpper, 0); 1801static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G0G1Mask => new UInt128(0x6000_0000_0000_0000, 0); 1807static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G0ToGwPlus1ExponentMask => new UInt128(0x7FFE_0000_0000_0000, 0); 1809static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G2ToGwPlus3ExponentMask => new UInt128(0x1FFF_8000_0000_0000, 0); 1811static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.GwPlus2ToGwPlus4SignificandMask => new UInt128(0x0001_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1813static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.GwPlus4SignificandMask => new UInt128(0x0000_7FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1815static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MaxSignificand => new UInt128(upper: 0x0001_ED09_BEAD_87C0, lower: 0x378D_8E63_FFFF_FFFF); // 9_999_999_999_999_999_999_999_999_999_999_999;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal32.cs (1)
466public static explicit operator Decimal32(Decimal128 value) => new Decimal32(Number.ConvertDecimalIeee754<Decimal128, UInt128, Decimal32, uint>(new UInt128(value._upper, value._lower)));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal64.cs (1)
451public static explicit operator Decimal64(Decimal128 value) => new Decimal64(Number.ConvertDecimalIeee754<Decimal128, UInt128, Decimal64, ulong>(new UInt128(value._upper, value._lower)));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (2)
86return CompareDecimal<Decimal128, UInt128>(new UInt128(xValue._upper, xValue._lower), new UInt128(yValue._upper, yValue._lower));
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (92)
496return new UInt128(value.High, value.Low64); 559UInt128 result = new UInt128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000); 576return new UInt128((ulong)(lower >> 63), (ulong)lower); 589return new UInt128(0, (ushort)value); 598return new UInt128((ulong)(lower >> 63), (ulong)lower); 611return new UInt128(0, (uint)value); 620return new UInt128((ulong)(lower >> 63), (ulong)lower); 633return new UInt128(0, (ulong)value); 642return new UInt128((ulong)(lower >> 63), (ulong)lower); 655return new UInt128(0, (nuint)value); 665return new UInt128((ulong)(lower >> 63), (ulong)lower); 679return new UInt128(0, (byte)value); 700public static implicit operator UInt128(byte value) => new UInt128(0, value); 705public static implicit operator UInt128(char value) => new UInt128(0, value); 711public static implicit operator UInt128(ushort value) => new UInt128(0, value); 717public static implicit operator UInt128(uint value) => new UInt128(0, value); 723public static implicit operator UInt128(ulong value) => new UInt128(0, value); 729public static implicit operator UInt128(nuint value) => new UInt128(0, value); 745return new UInt128(upper, lower); 758return new UInt128(upper, lower); 836UInt128 valMiLo = new UInt128(valMi, valLo); 846UInt128 divisor = new UInt128(divHi, divLo); 847UInt128 chkMiLo = new UInt128(chkMi, chkLo); 894return (new UInt128(highRes, lowRes), remainder); 909return (new UInt128(highRes, lowRes), remainder >> shift); 942Debug.Assert(Math.BigMul(quo, divisor) + rem == (new UInt128(hi, lo))); 985Debug.Assert(new UInt128(valHi, valMiLo) < new UInt128(chkHi, chkLo)); 998Debug.Assert(new UInt128(valHi, valMiLo) == new UInt128(chkHi, chkLo) + remainder); 1040new UInt128(0, 1UL), 1041new UInt128(0, 10UL), 1042new UInt128(0, 100UL), 1043new UInt128(0, 1_000UL), 1044new UInt128(0, 10_000UL), 1045new UInt128(0, 100_000UL), 1046new UInt128(0, 1_000_000UL), 1047new UInt128(0, 10_000_000UL), 1048new UInt128(0, 100_000_000UL), 1049new UInt128(0, 1_000_000_000UL), 1050new UInt128(0, 10_000_000_000UL), 1051new UInt128(0, 100_000_000_000UL), 1052new UInt128(0, 1_000_000_000_000UL), 1053new UInt128(0, 10_000_000_000_000UL), 1054new UInt128(0, 100_000_000_000_000UL), 1055new UInt128(0, 1_000_000_000_000_000UL), 1056new UInt128(0, 10_000_000_000_000_000UL), 1057new UInt128(0, 100_000_000_000_000_000UL), 1058new UInt128(0, 1_000_000_000_000_000_000UL), 1059new UInt128(0, 10_000_000_000_000_000_000UL), 1060new UInt128(5, 7766279631452241920UL), 1061new UInt128(54, 3875820019684212736UL), 1062new UInt128(542, 1864712049423024128UL), 1063new UInt128(5421, 200376420520689664UL), 1064new UInt128(54210, 2003764205206896640UL), 1065new UInt128(542101, 1590897978359414784UL), 1066new UInt128(5421010, 15908979783594147840UL), 1067new UInt128(54210108, 11515845246265065472UL), 1068new UInt128(542101086, 4477988020393345024UL), 1069new UInt128(5421010862, 7886392056514347008UL), 1070new UInt128(54210108624, 5076944270305263616UL), 1071new UInt128(542101086242, 13875954555633532928UL), 1072new UInt128(5421010862427, 9632337040368467968UL), 1073new UInt128(54210108624275, 4089650035136921600UL), 1074new UInt128(542101086242752, 4003012203950112768UL), 1075new UInt128(5421010862427522, 3136633892082024448UL), 1076new UInt128(54210108624275221, 12919594847110692864UL), 1077new UInt128(542101086242752217, 68739955140067328UL), 1078new UInt128(5421010862427522170, 687399551400673280UL), 1242static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1262public static UInt128 operator &(UInt128 left, UInt128 right) => new UInt128(left._upper & right._upper, left._lower & right._lower); 1265public static UInt128 operator |(UInt128 left, UInt128 right) => new UInt128(left._upper | right._upper, left._lower | right._lower); 1268public static UInt128 operator ^(UInt128 left, UInt128 right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower); 1271public static UInt128 operator ~(UInt128 value) => new UInt128(~value._upper, ~value._lower); 1351public static UInt128 MinValue => new UInt128(0, 0); 1354public static UInt128 MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1380return new UInt128(upper, lower); 1419lower = new UInt128(tl._lower, mull._lower); 1470public static UInt128 One => new UInt128(0, 1); 1903short actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x0000_0000_0000_7FFF)) ? short.MaxValue : (short)value; 1909int actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x0000_0000_7FFF_FFFF)) ? int.MaxValue : (int)value; 1915long actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? long.MaxValue : (long)value; 1921Int128 actualResult = (value >= new UInt128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? Int128.MaxValue : (Int128)value; 1932nint actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? nint.MaxValue : (nint)value; 1939sbyte actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x0000_0000_0000_007F)) ? sbyte.MaxValue : (sbyte)value; 2077return new UInt128(upper, 0); 2087return new UInt128(upper, lower); 2113return new UInt128(0, lower); 2123return new UInt128(upper, lower); 2155return new UInt128(upper, lower); 2168return new UInt128(upper, lower); 2222static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
System.Runtime.Numerics (8)
System\Numerics\BigInteger.cs (8)
2330uu = len > 1 ? new UInt128(value._bits[1], value._bits[0]) : (UInt128)(ulong)value._bits[0]; 2334uu = new UInt128( 2457? new UInt128(value._bits[1], value._bits[0]) 2462return new UInt128( 2580else if (x <= new UInt128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) 2651else if (value <= new UInt128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) 5147UInt128 bits = new(upperBits, lowerBits); 5341UInt128 bits = new(upperBits, lowerBits);
1350 references to UInt128
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126public static UInt128 HashToUInt128(ReadOnlySpan<byte> source, long seed = 0) 211public UInt128 GetCurrentHashAsUInt128()
Microsoft.AspNetCore.Components.Endpoints (7)
FormMapping\Converters\NullableConverter.cs (1)
72type == typeof(UInt128) ||
FormMapping\WellKnownConverters.cs (6)
35{ typeof(UInt128), new ParsableConverter<UInt128>() }, 67converters.Add(typeof(UInt128?), new NullableConverter<UInt128>((FormDataConverter<UInt128>)converters[typeof(UInt128)]));
Microsoft.AspNetCore.Http.Extensions (7)
src\aspnetcore\src\Components\Endpoints\src\FormMapping\Converters\NullableConverter.cs (1)
72type == typeof(UInt128) ||
src\aspnetcore\src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
35{ typeof(UInt128), new ParsableConverter<UInt128>() }, 67converters.Add(typeof(UInt128?), new NullableConverter<UInt128>((FormDataConverter<UInt128>)converters[typeof(UInt128)]));
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiConstants.cs (1)
36typeof(UInt128),
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHash128.cs (2)
124public static UInt128 HashToUInt128(ReadOnlySpan<byte> source, long seed = 0) 209public UInt128 GetCurrentHashAsUInt128()
Microsoft.CodeAnalysis (2)
Hashing\XxHash128.cs (2)
126public static UInt128 HashToUInt128(ReadOnlySpan<byte> source, long seed = 0) 211public UInt128 GetCurrentHashAsUInt128()
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126public static UInt128 HashToUInt128(ReadOnlySpan<byte> source, long seed = 0) 211public UInt128 GetCurrentHashAsUInt128()
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
64yield return new TestData<UInt128>(42, """{"type":"integer"}"""); 1224[JsonSerializable(typeof(UInt128))]
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
64yield return new TestData<UInt128>(42, """{"type":"integer"}"""); 1224[JsonSerializable(typeof(UInt128))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
71typeof(T) == typeof(UInt128) ||
System.ComponentModel.TypeConverter (5)
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
165[typeof(UInt128)] = new IntrinsicTypeConverterData((type) => new UInt128Converter()),
System\ComponentModel\UInt128Converter.cs (4)
18internal override Type TargetType => typeof(UInt128); 28return UInt128.Parse(value, NumberStyles.HexNumber); 35UInt128.Parse(value, formatInfo); 41((UInt128)value).ToString(formatInfo);
System.IO.Compression (1)
System\IO\Compression\WinZipAesStream.cs (1)
23private UInt128 _counter = 1;
System.IO.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
122public static UInt128 HashToUInt128(ReadOnlySpan<byte> source, long seed = 0) 207public UInt128 GetCurrentHashAsUInt128()
System.Linq (7)
System\Linq\Max.cs (2)
353if (typeof(TSource) == typeof(UInt128)) return (TSource)(object)MaxIntegerEnumerator((IEnumerable<UInt128>)source);
System\Linq\Min.cs (2)
332if (typeof(TSource) == typeof(UInt128)) return (TSource)(object)MinIntegerEnumerator((IEnumerable<UInt128>)source);
System\Linq\OrderBy.cs (1)
161t == typeof(Int128) || t == typeof(UInt128) ||
System\Linq\Sequence.cs (2)
91if (typeof(T) == typeof(ulong) && (range = TryUseRange<UInt128>(start, endInclusive, step, ulong.MaxValue)) is not null) return range; 93if (typeof(T) == typeof(nuint) && (range = TryUseRange<UInt128>(start, endInclusive, step, nuint.MaxValue)) is not null) return range;
System.Net.Primitives (12)
System\Net\IPNetwork.cs (12)
93UInt128 baseAddressValue = default; 94UInt128 otherAddressValue = default; 96BaseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<UInt128>(ref baseAddressValue)), out int bytesWritten); 98address.TryWriteBytes(MemoryMarshal.AsBytes(new Span<UInt128>(ref otherAddressValue)), out bytesWritten); 101UInt128 mask = UInt128.MaxValue << (128 - PrefixLength); 262UInt128 value = default; 263baseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<UInt128>(ref value)), out int bytesWritten); 266UInt128 mask = UInt128.MaxValue << (128 - prefixLength); 272UInt128 newAddress = value & mask; 275: new IPAddress(MemoryMarshal.AsBytes(new Span<UInt128>(ref newAddress)));
System.Numerics.Tensors (2)
System\Numerics\Tensors\netcore\TensorPrimitives.IsNegative.cs (1)
64typeof(T) != typeof(UInt128);
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
77typeof(T) == typeof(Int128) || typeof(T) == typeof(UInt128) ||
System.Private.CoreLib (1182)
src\runtime\src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (10)
287public static byte[] GetBytes(UInt128 value) 289byte[] bytes = new byte[UInt128.Size]; 302public static bool TryWriteBytes(Span<byte> destination, UInt128 value) 304if (destination.Length < UInt128.Size) 697public static UInt128 ToUInt128(byte[] value, int startIndex) 703if (startIndex > value.Length - UInt128.Size) 706return Unsafe.ReadUnaligned<UInt128>(ref value[startIndex]); 717public static UInt128 ToUInt128(ReadOnlySpan<byte> value) 719if (value.Length < UInt128.Size) 721return Unsafe.ReadUnaligned<UInt128>(ref MemoryMarshal.GetReference(value));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (9)
220/// Reads a <see cref="UInt128" /> from the beginning of a read-only span of bytes, as big endian. 226/// <paramref name="source"/> is too small to contain a <see cref="UInt128" />. 230public static UInt128 ReadUInt128BigEndian(ReadOnlySpan<byte> source) 233ReverseEndianness(MemoryMarshal.Read<UInt128>(source)) : 234MemoryMarshal.Read<UInt128>(source); 522/// Reads a <see cref="UInt128" /> from the beginning of a read-only span of bytes, as big endian. 527/// <see langword="true" /> if the span is large enough to contain a <see cref="UInt128" />; otherwise, <see langword="false" />. 532public static bool TryReadUInt128BigEndian(ReadOnlySpan<byte> source, out UInt128 value) 536bool success = MemoryMarshal.TryRead(source, out UInt128 tmp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (9)
220/// Reads a <see cref="UInt128" /> from the beginning of a read-only span of bytes, as little endian. 226/// <paramref name="source"/> is too small to contain a <see cref="UInt128" />. 230public static UInt128 ReadUInt128LittleEndian(ReadOnlySpan<byte> source) 233ReverseEndianness(MemoryMarshal.Read<UInt128>(source)) : 234MemoryMarshal.Read<UInt128>(source); 522/// Reads a <see cref="UInt128" /> from the beginning of a read-only span of bytes, as little endian. 527/// <see langword="true" /> if the span is large enough to contain a <see cref="UInt128" />; otherwise, <see langword="false" />. 532public static bool TryReadUInt128LittleEndian(ReadOnlySpan<byte> source, out UInt128 value) 539bool success = MemoryMarshal.TryRead(source, out UInt128 tmp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (7)
181/// Reverses a primitive value by performing an endianness swap of the specified <see cref="UInt128" /> value. 187public static UInt128 ReverseEndianness(UInt128 value) 375public static void ReverseEndianness(ReadOnlySpan<UInt128> source, Span<UInt128> destination) => 376ReverseEndianness(MemoryMarshal.Cast<UInt128, Int128>(source), MemoryMarshal.Cast<UInt128, Int128>(destination));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (8)
292/// Writes a <see cref="UInt128" /> into a span of bytes, as big endian. 298/// <paramref name="destination" /> is too small to contain a <see cref="UInt128" />. 302public static void WriteUInt128BigEndian(Span<byte> destination, UInt128 value) 306UInt128 tmp = ReverseEndianness(value); 595/// Writes a <see cref="UInt128" /> into a span of bytes, as big endian. 600/// <see langword="true" /> if the span is large enough to contain a <see cref="UInt128" />; otherwise, <see langword="false" />. 605public static bool TryWriteUInt128BigEndian(Span<byte> destination, UInt128 value) 609UInt128 tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (8)
292/// Writes a <see cref="UInt128" /> into a span of bytes, as little endian. 298/// <paramref name="destination" /> is too small to contain a <see cref="UInt128" />. 302public static void WriteUInt128LittleEndian(Span<byte> destination, UInt128 value) 306UInt128 tmp = ReverseEndianness(value); 595/// Writes a <see cref="UInt128" /> into a span of bytes, as little endian. 600/// <see langword="true" /> if the span is large enough to contain a <see cref="UInt128" />; otherwise, <see langword="false" />. 605public static bool TryWriteUInt128LittleEndian(Span<byte> destination, UInt128 value) 609UInt128 tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.Int128.cs (3)
12public static int CountDigits(UInt128 value) 53public static int CountHexDigits(UInt128 value) 56return ((int)UInt128.Log2(value) >> 2) + 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Byte.cs (9)
726else if (typeof(TOther) == typeof(UInt128)) 728UInt128 actualValue = (UInt128)(object)value; 793else if (typeof(TOther) == typeof(UInt128)) 795UInt128 actualValue = (UInt128)(object)value; 860else if (typeof(TOther) == typeof(UInt128)) 862UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (9)
1606else if (typeof(TOther) == typeof(UInt128)) 1608UInt128 actualValue = (UInt128)(object)value; 1669else if (typeof(TOther) == typeof(UInt128)) 1671UInt128 actualValue = (UInt128)(object)value; 1732else if (typeof(TOther) == typeof(UInt128)) 1734UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (6)
1514else if (typeof(TOther) == typeof(UInt128)) 1516UInt128 actualValue = (UInt128)(object)value; 1590else if (typeof(TOther) == typeof(UInt128)) 1592UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (33)
1614UInt128 mantissa; 1627mantissa = (UInt128)significand << exponent; 1641UInt128 numerator = (UInt128)significand * Pow5(scale); 1644if ((mantissa >> 96) == UInt128.Zero) 1655if (mantissa == UInt128.Zero) 1749UInt128 mantissa = new UInt128(high, low64); 1750if (mantissa == UInt128.Zero) 1753UInt128 divisor = Pow5(scale); // 5^scale 1755int mantissaBits = 128 - (int)UInt128.LeadingZeroCount(mantissa); 1756int divisorBits = 128 - (int)UInt128.LeadingZeroCount(divisor); 1762UInt128 numerator, denominator; 1774(UInt128 quotient, UInt128 remainder) = UInt128.DivRem(numerator, denominator); 1777int quotientBits = 128 - (int)UInt128.LeadingZeroCount(quotient); 1782ulong roundBits = (ulong)(quotient & ((UInt128.One << drop) - 1)); 1784bool sticky = (remainder != UInt128.Zero) || ((roundBits & (half - 1)) != 0); 1807/// 5 raised to <paramref name="exponent"/> as a <see cref="UInt128"/>, for <c>0 &lt;= exponent &lt;= DEC_SCALE_MAX</c>. 1809private static UInt128 Pow5(int exponent) 1830private static UInt128 RoundShiftRightEven(UInt128 value, int shift) 1839if ((shift == 128) && (value > (UInt128.One << 127))) 1840return UInt128.One; 1841return UInt128.Zero; 1844UInt128 quotient = value >> shift; 1845UInt128 remainder = value & ((UInt128.One << shift) - UInt128.One); 1846UInt128 half = UInt128.One << (shift - 1); 1848if ((remainder > half) || ((remainder == half) && ((quotient & UInt128.One) != UInt128.Zero)))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (6)
1362else if (typeof(TOther) == typeof(UInt128)) 1364UInt128 actualResult = checked((UInt128)value); 1472else if (typeof(TOther) == typeof(UInt128)) 1474UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Half.cs (15)
960/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="UInt128"/>.</summary> 964public static explicit operator UInt128(Half value) => (UInt128)(double)(value); 966/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="UInt128"/>, throwing an overflow exception for any values that fall outside the representable range.</summary> 969/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 971public static explicit operator checked UInt128(Half value) => checked((UInt128)(double)(value)); 2060else if (typeof(TOther) == typeof(UInt128)) 2062UInt128 actualResult = checked((UInt128)value); 2158else if (typeof(TOther) == typeof(UInt128)) 2160UInt128 actualResult = (value == PositiveInfinity) ? UInt128.MaxValue : 2161(value <= Zero) ? UInt128.MinValue : (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (38)
217return -(decimal)(UInt128)(value); 219return (decimal)(UInt128)(value); 230return -(double)(UInt128)(value); 232return (double)(UInt128)(value); 243return -(Half)(UInt128)(value); 245return (Half)(UInt128)(value); 353return -(float)(UInt128)(value); 355return (float)(UInt128)(value); 418/// <summary>Explicitly converts a 128-bit signed integer to a <see cref="UInt128" /> value.</summary> 420/// <returns><paramref name="value" /> converted to a <see cref="UInt128" />.</returns> 422public static explicit operator UInt128(Int128 value) => new UInt128(value._upper, value._lower); 424/// <summary>Explicitly converts a 128-bit signed integer to a <see cref="UInt128" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary> 426/// <returns><paramref name="value" /> converted to a <see cref="UInt128" />.</returns> 429public static explicit operator checked UInt128(Int128 value) 730return (Int128)UInt128.Log10((UInt128)value); 1070UInt128 result = (UInt128)(left) / (UInt128)(right); 1142return (Int128)((UInt128)(left) * (UInt128)(right)); 1180UInt128 upper = UInt128.BigMul((UInt128)(left), (UInt128)(right), out UInt128 ulower); 1746else if (typeof(TOther) == typeof(UInt128)) 1748UInt128 actualResult = checked((UInt128)value); 1820else if (typeof(TOther) == typeof(UInt128)) 1822UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1890else if (typeof(TOther) == typeof(UInt128)) 1892UInt128 actualResult = (UInt128)value; 2148static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsGreaterThanAsUnsigned(Int128 left, Int128 right) => (UInt128)(left) > (UInt128)(right);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (10)
1144else if (typeof(TOther) == typeof(UInt128)) 1146UInt128 actualResult = checked((UInt128)value); 1213else if (typeof(TOther) == typeof(UInt128)) 1215UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1281else if (typeof(TOther) == typeof(UInt128)) 1283UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (10)
1193else if (typeof(TOther) == typeof(UInt128)) 1195UInt128 actualResult = checked((UInt128)value); 1264else if (typeof(TOther) == typeof(UInt128)) 1266UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1332else if (typeof(TOther) == typeof(UInt128)) 1334UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
1188else if (typeof(TOther) == typeof(UInt128)) 1190UInt128 actualResult = checked((UInt128)value); 1260else if (typeof(TOther) == typeof(UInt128)) 1262UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1335else if (typeof(TOther) == typeof(UInt128)) 1337UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (10)
1208else if (typeof(TOther) == typeof(UInt128)) 1210UInt128 actualResult = checked((UInt128)value); 1280else if (typeof(TOther) == typeof(UInt128)) 1282UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1348else if (typeof(TOther) == typeof(UInt128)) 1350UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
282public static UInt128 BigMul(ulong a, ulong b)
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.MinMax.cs (6)
40if (typeof(T) == typeof(UInt128)) return MinMaxInteger<T, UInt128, MinCalc<UInt128>>(span); 93if (typeof(T) == typeof(UInt128)) return MinMaxInteger<T, UInt128, MaxCalc<UInt128>>(span);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (1)
1352public UInt128 ToUInt128()
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.cs (47)
2385UInt128 product = (UInt128)ulong.CreateTruncating(left) * ulong.CreateTruncating(right); 2597UInt128 wide = ((UInt128)ulong.CreateTruncating(high) << 64) | ulong.CreateTruncating(low); 2720UInt128 wide = ((UInt128)ulong.CreateTruncating(high) << 64) | ulong.CreateTruncating(low); 2722UInt128 scale = UInt128.One; 2727UInt128 power = scale * 10; 2729(UInt128 quotient, UInt128 remainder) = UInt128.DivRem(wide, power); 2731sticky |= (remainder % scale) != UInt128.Zero; 3304/// not fit in <see cref="UInt128"/> (and therefore in no integer type). 3306private static DecimalIeee754ToIntegerStatus DecimalIeee754ToIntegerMagnitude<TDecimal, TValue>(TValue decimalBits, out bool isNegative, out UInt128 magnitude, out bool exceedsUInt128) 3311magnitude = UInt128.Zero; 3327UInt128 significand = UInt128.CreateTruncating(decoded.Significand); 3330if (significand == UInt128.Zero) 3341if (significand > UInt128.MaxValue / 10) 3349magnitude = exceedsUInt128 ? UInt128.Zero : significand; 3357for (int i = 0; (i < drop) && (significand != UInt128.Zero); i++) 3379DecimalIeee754ToIntegerStatus status = DecimalIeee754ToIntegerMagnitude<TDecimal, TValue>(decimalBits, out bool isNegative, out UInt128 magnitude, out bool exceedsUInt128); 3382UInt128 maxMagnitude = UInt128.CreateTruncating(TInteger.MaxValue); 3384UInt128 minMagnitude = isUnsigned ? UInt128.Zero : maxMagnitude + UInt128.One; 3434if ((magnitude != UInt128.Zero) && isChecked) 3471UInt128 bits = UInt128.CreateTruncating(value); 3475UInt128 magnitude = isNegative ? (~bits) + UInt128.One : bits; 3480if (magnitude <= UInt128.CreateTruncating(TDecimal.MaxSignificand)) 3493private static TValue DecimalIeee754FromMagnitude<TDecimal, TValue>(bool sign, UInt128 magnitude, int exponent) 3497if (magnitude == UInt128.Zero) 3521private static int WriteDecimalDigits(UInt128 magnitude, Span<byte> digits) 3523Debug.Assert(magnitude != UInt128.Zero); 3529while (magnitude != UInt128.Zero) 3531(magnitude, UInt128 digit) = UInt128.DivRem(magnitude, 10); 3570UInt128 magnitude = UInt128.CreateTruncating(decoded.Significand); 3637UInt128 magnitude = UInt128.CreateTruncating(decoded.Significand); 3763UInt128 magnitude = UInt128.CreateTruncating(decoded.Significand);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128.cs (2)
507private static DiyFp128 Float128UnpackFinite(UInt128 packed) 543private static UInt128 Float128PackFinite(DiyFp128 value)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Conversions.cs (31)
29private static DiyFp128 DiyFp128FromUInt128(UInt128 coefficient, uint sign) 31Debug.Assert(coefficient != UInt128.Zero); 33int leadingZeros = (int)UInt128.LeadingZeroCount(coefficient); 34UInt128 fraction = coefficient << leadingZeros; // most significant bit at bit 127 57DiyFp128 pow = DiyFp128FromUInt128(UInt128.CreateTruncating(TDecimal.Power10(chunk)), 0); 85DiyFp128 value = DiyFp128FromUInt128(UInt128.CreateTruncating(significand), signed ? UxSignBit : 0); 117UInt128 pow10P = UInt128.CreateTruncating(TDecimal.MaxSignificand); 119UInt128 pow10Pm1 = UInt128.CreateTruncating(TDecimal.Power10(precision - 1)); // 10^(P-1) 121UInt128 coefficient; 135if ((coefficient != UInt128.Zero) && (coefficient < pow10Pm1)) 153private static UInt128 DiyFp128RoundToUInt128(DiyFp128 value) 158UInt128 fraction = new UInt128(value._hi, value._lo); 159UInt128 integer = fraction >> shift; 160UInt128 remainder = fraction & ((UInt128.One << shift) - UInt128.One); 161UInt128 half = UInt128.One << (shift - 1); 163if ((remainder > half) || ((remainder == half) && UInt128.IsOddInteger(integer))) 176private static TValue EncodeDecimalFromUInt128<TDecimal, TValue>(bool signed, UInt128 coefficient, int exponent) 180if (coefficient == UInt128.Zero) 195if (deficit >= UInt128.PowersOf10.Length) 201UInt128 power = UInt128.PowersOf10[deficit]; 202UInt128 quotient = coefficient / power; 203UInt128 remainder = coefficient - (quotient * power); 204UInt128 half = power >> 1; // 10^deficit is even, so this is an exact half 206if ((remainder > half) || ((remainder == half) && UInt128.IsOddInteger(quotient))) 214if (coefficient == UInt128.Zero)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128DecimalReduce.cs (30)
103private static bool DiyFp128DecimalReduceExact(UInt128 coefficient, int unbiasedExponent) 113UInt128 pow5 = DiyFp128Pow5(unbiasedExponent); 114return coefficient <= (UInt128.MaxValue / pow5); 124return (coefficient % DiyFp128Pow5(k)) == UInt128.Zero; 127private static UInt128 DiyFp128Pow5(int n) 129UInt128 result = UInt128.One; 143private static int DiyFp128DecimalRadianReduce(uint sign, UInt128 coefficient, int unbiasedExponent, int octant, out DiyFp128 reduced) 186private static int DiyFp128ReduceBuildInteger(UInt128 coefficient, int power, Span<ulong> integerWords) 204UInt128 carry = 0; 207UInt128 product = ((UInt128)integerWords[i] * multiplier) + carry; 233Span<UInt128> columnLo = stackalloc UInt128[TrigReduceWords + Guard]; 240UInt128 acc = 0; 251UInt128 next = acc + ((UInt128)integerWords[j] * TrigOneOverTwoPi[fi]); 271private static void DiyFp128ReduceFractionNegative(UInt128 coefficient, int k, Span<ulong> fractionWords) 291UInt128 cur = ((UInt128)rem << 64) | moduli[i]; 293rem = (ulong)(cur - ((UInt128)q * divisor)); 308Span<UInt128> columnLo = stackalloc UInt128[TrigReduceWords + Guard]; 313UInt128 acc = 0; 325UInt128 next = acc + ((UInt128)ca * moduli[b]); 344private static void DiyFp128ReducePropagate(ReadOnlySpan<UInt128> columnLo, ReadOnlySpan<ulong> columnHi, int columns, Span<ulong> fractionWords) 346UInt128 carry = 0; 350UInt128 lo = columnLo[t] + carry; 360carry = ((UInt128)fullHi << 64) | (lo >> 64);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128PiTrig.cs (5)
95UInt128 significand = new UInt128(value._hi, value._lo); 97UInt128 fractionBits = significand & ((UInt128.One << shift) - UInt128.One); 104if (fractionBits == UInt128.Zero)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Trig.cs (16)
164UInt128 p = (UInt128)a * b; 171UInt128 p = (UInt128)a * b + addLo; 178UInt128 p = (UInt128)a * b + new UInt128(addHi, addLo); 185UInt128 prod = (UInt128)a * b; 186UInt128 addend = new UInt128(addHi, addLo); 187UInt128 s = prod + addend; 196UInt128 prod = (UInt128)a * b + new UInt128(carryIn, 0); 197UInt128 addend = new UInt128(addHi, addLo); 198UInt128 s = prod + addend; 502public readonly UInt128 Coefficient; 507public DiyFp128TrigReduceArg(DiyFp128 value, UInt128 coefficient, int exponent, uint sign, bool useDecimal)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.Transcendental.cs (2)
968UInt128 coefficient = UInt128.CreateTruncating(decoded.Significand);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (38)
1497? UInt128ToDecStr((UInt128)value, digits: -1) 1513? UInt128ToDecStr((UInt128)value, digits) 1560? TryUInt128ToDecStr((UInt128)value, digits: -1, destination, out charsWritten) 1574? TryUInt128ToDecStr((UInt128)value, digits, destination, out charsWritten) 1613public static string FormatUInt128(UInt128 value, string? format, IFormatProvider? provider) 1623static unsafe string FormatUInt128Slow(UInt128 value, string? format, IFormatProvider? provider) 1670public static bool TryFormatUInt128<TChar>(UInt128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 1682static unsafe bool TryFormatUInt128Slow(UInt128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) 2600byte* p = UInt128ToDecChars(buffer + Int128Precision, (UInt128)value, 0); 2620? UInt128ToDecStr((UInt128)value, -1) 2633UInt128 absValue = (UInt128)(-value); 2661UInt128 absValue = (UInt128)(-value); 2692UInt128 uValue = (UInt128)value; 2713UInt128 uValue = (UInt128)value; 2732private static unsafe TChar* Int128ToHexChars<TChar>(TChar* buffer, UInt128 value, int hexBase, int digits) where TChar : unmanaged, IUtfChar<TChar> 2755UInt128 uValue = (UInt128)value; 2757int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value)); 2776UInt128 uValue = (UInt128)value; 2778int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value)); 2795private static unsafe TChar* UInt128ToBinaryChars<TChar>(TChar* buffer, UInt128 value, int digits) where TChar : unmanaged, IUtfChar<TChar> 2811internal static unsafe void UInt128ToNumber(UInt128 value, ref NumberBuffer number) 2835private static ulong Int128DivMod1E19(ref UInt128 value) 2837UInt128 divisor = new UInt128(0, 10_000_000_000_000_000_000); 2838(value, UInt128 remainder) = UInt128.DivRem(value, divisor); 2843internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd, UInt128 value) where TChar : unmanaged, IUtfChar<TChar> 2855internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd, UInt128 value, int digits) where TChar : unmanaged, IUtfChar<TChar> 2867internal static unsafe string UInt128ToDecStr(UInt128 value) 2886internal static unsafe string UInt128ToDecStr(UInt128 value, int digits) 2904private static unsafe bool TryUInt128ToDecStr<TChar>(UInt128 value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\BFloat16.cs (20)
642/// <summary>Explicitly converts a <see cref="UInt128" /> value to its nearest representable <see cref="BFloat16"/> value.</summary> 646public static explicit operator BFloat16(UInt128 value) => RoundFromUnsigned(value); 786/// <summary>Explicitly converts a <see cref="BFloat16" /> value to its nearest representable <see cref="UInt128"/>.</summary> 790public static explicit operator UInt128(BFloat16 value) => (UInt128)(double)(value); 792/// <summary>Explicitly converts a <see cref="BFloat16" /> value to its nearest representable <see cref="UInt128"/>, throwing an overflow exception for any values that fall outside the representable range.</summary> 795/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 797public static explicit operator checked UInt128(BFloat16 value) => checked((UInt128)(double)(value)); 1658else if (typeof(TOther) == typeof(UInt128)) 1660UInt128 actualValue = (UInt128)(object)value; 1774else if (typeof(TOther) == typeof(UInt128)) 1776UInt128 actualResult = checked((UInt128)value); 1923else if (typeof(TOther) == typeof(UInt128)) 1925UInt128 actualResult = (value == PositiveInfinity) ? UInt128.MaxValue : 1926(value <= Zero) ? UInt128.MinValue : (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal128.cs (288)
26IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128> 40private static UInt128 PositiveInfinityValue => new UInt128(upper: 0x7800_0000_0000_0000, lower: 0); 41private static UInt128 NegativeInfinityValue => new UInt128(upper: 0xF800_0000_0000_0000, lower: 0); 44private static UInt128 ZeroValue => new UInt128(0x3040_0000_0000_0000, 0); 45private static UInt128 NegativeZeroValue => new UInt128(0xB040_0000_0000_0000, 0); 47private static UInt128 OneValue => new UInt128(0x3040_0000_0000_0000, 1); 48private static UInt128 NegativeOneValue => new UInt128(0xB040_0000_0000_0000, 1); 50private static UInt128 EValue => new UInt128(0x2FFE_8605_8A4B_F4DE, 0x4E90_6ACC_B26A_BB56); // +2.718281828459045235360287471352662 51private static UInt128 PiValue => new UInt128(0x2FFE_9AE4_7957_96A7, 0xBABE_5564_E6F3_9F8F); // +3.141592653589793238462643383279503 52private static UInt128 TauValue => new UInt128(0x2FFF_35C8_F2AF_2D4F, 0x757C_AAC9_CDE7_3F1E); // +6.283185307179586476925286766559006 53private static UInt128 QuietNaNValue => new UInt128(0xFC00_0000_0000_0000, 0); 54private static UInt128 NaNPayloadMask => new UInt128(0x0000_3FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 85internal Decimal128(UInt128 value) 133return Number.ParseDecimalIeee754<char, Decimal128, UInt128>(s, style, NumberFormatInfo.GetInstance(provider)); 191return Number.TryParseDecimalIeee754<char, Decimal128, UInt128>(s, style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK; 205return Number.TryParseDecimalIeee754<char, Decimal128, UInt128>(s.AsSpan(), style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK; 221var current = new UInt128(_upper, _lower); 222var another = new UInt128(other._upper, other._lower); 223return Number.CompareDecimalIeee754<Decimal128, UInt128>(current, another); 229var current = new UInt128(_upper, _lower); 230var another = new UInt128(other._upper, other._lower); 231return Number.CompareDecimalIeee754<Decimal128, UInt128>(current, another) == 0; 247return Number.GetDecimalIeee754HashCode<Decimal128, UInt128>(new UInt128(_upper, _lower)); 254public static UInt128 EncodeBinary(Decimal128 x) => new UInt128(x._upper, x._lower); 260public static Decimal128 DecodeBinary(UInt128 x) => new Decimal128(x); 266public static UInt128 EncodeDecimal(Decimal128 x) => Number.EncodeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 272public static Decimal128 DecodeDecimal(UInt128 x) => new Decimal128(Number.DecodeDecimalIeee754<Decimal128, UInt128>(x)); 279return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), null, NumberFormatInfo.CurrentInfo); 287return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), format, NumberFormatInfo.CurrentInfo); 295return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), null, NumberFormatInfo.GetInstance(provider)); 303return Number.FormatDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider)); 309return Number.TryFormatDecimalIeee754<Decimal128, UInt128, char>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), destination, out charsWritten); 315return Number.TryFormatDecimalIeee754<Decimal128, UInt128, byte>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), utf8Destination, out bytesWritten); 333UInt128 result = Number.AddDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), OneValue); 342UInt128 result = Number.SubtractDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), OneValue); 352UInt128 result = Number.AddDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 362UInt128 result = Number.SubtractDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 372UInt128 result = Number.MultiplyDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 382UInt128 result = Number.DivideDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 392UInt128 result = Number.RemainderDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 403public static explicit operator Decimal128(Int128 value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, Int128>(value)); 405/// <summary>Explicitly converts a <see cref="System.UInt128" /> value to its nearest representable <see cref="System.Numerics.Decimal128" /> value.</summary> 409public static explicit operator Decimal128(UInt128 value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, UInt128>(value)); 414public static explicit operator Decimal128(Half value) => new Decimal128(Number.ConvertFloatToDecimalIeee754<Half, Decimal128, UInt128>(value)); 419public static explicit operator Decimal128(float value) => new Decimal128(Number.ConvertFloatToDecimalIeee754<float, Decimal128, UInt128>(value)); 424public static explicit operator Decimal128(double value) => new Decimal128(Number.ConvertFloatToDecimalIeee754<double, Decimal128, UInt128>(value)); 433public static explicit operator byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, byte>(new UInt128(value._upper, value._lower), isChecked: false); 439public static explicit operator checked byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, byte>(new UInt128(value._upper, value._lower), isChecked: true); 445public static explicit operator sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, sbyte>(new UInt128(value._upper, value._lower), isChecked: false); 452public static explicit operator checked sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, sbyte>(new UInt128(value._upper, value._lower), isChecked: true); 457public static explicit operator char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: false); 463public static explicit operator checked char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: true); 468public static explicit operator short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, short>(new UInt128(value._upper, value._lower), isChecked: false); 474public static explicit operator checked short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, short>(new UInt128(value._upper, value._lower), isChecked: true); 480public static explicit operator ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: false); 487public static explicit operator checked ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new UInt128(value._upper, value._lower), isChecked: true); 492public static explicit operator int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, int>(new UInt128(value._upper, value._lower), isChecked: false); 498public static explicit operator checked int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, int>(new UInt128(value._upper, value._lower), isChecked: true); 504public static explicit operator uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, uint>(new UInt128(value._upper, value._lower), isChecked: false); 511public static explicit operator checked uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, uint>(new UInt128(value._upper, value._lower), isChecked: true); 516public static explicit operator nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nint>(new UInt128(value._upper, value._lower), isChecked: false); 522public static explicit operator checked nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nint>(new UInt128(value._upper, value._lower), isChecked: true); 528public static explicit operator nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nuint>(new UInt128(value._upper, value._lower), isChecked: false); 535public static explicit operator checked nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nuint>(new UInt128(value._upper, value._lower), isChecked: true); 540public static explicit operator long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, long>(new UInt128(value._upper, value._lower), isChecked: false); 546public static explicit operator checked long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, long>(new UInt128(value._upper, value._lower), isChecked: true); 552public static explicit operator ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ulong>(new UInt128(value._upper, value._lower), isChecked: false); 559public static explicit operator checked ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ulong>(new UInt128(value._upper, value._lower), isChecked: true); 564public static explicit operator Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, Int128>(new UInt128(value._upper, value._lower), isChecked: false); 570public static explicit operator checked Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, Int128>(new UInt128(value._upper, value._lower), isChecked: true); 572/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal128" /> value to its nearest representable <see cref="System.UInt128" /> value.</summary> 574/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt128" /> value.</returns> 576public static explicit operator UInt128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, UInt128>(new UInt128(value._upper, value._lower), isChecked: false); 578/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal128" /> value to its nearest representable <see cref="System.UInt128" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary> 580/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt128" /> value.</returns> 581/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.UInt128" />.</exception> 583public static explicit operator checked UInt128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, UInt128>(new UInt128(value._upper, value._lower), isChecked: true); 588public static explicit operator Half(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, Half>(new UInt128(value._upper, value._lower)); 593public static explicit operator float(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, float>(new UInt128(value._upper, value._lower)); 598public static explicit operator double(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, double>(new UInt128(value._upper, value._lower)); 604public static explicit operator decimal(Decimal128 value) => Number.ConvertDecimalIeee754ToDecimal<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 613public static implicit operator Decimal128(byte value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, byte>(value)); 619public static implicit operator Decimal128(sbyte value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, sbyte>(value)); 624public static implicit operator Decimal128(char value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, ushort>(value)); 629public static implicit operator Decimal128(short value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, short>(value)); 635public static implicit operator Decimal128(ushort value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, ushort>(value)); 640public static implicit operator Decimal128(int value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, int>(value)); 646public static implicit operator Decimal128(uint value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, uint>(value)); 651public static implicit operator Decimal128(nint value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, nint>(value)); 657public static implicit operator Decimal128(nuint value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, nuint>(value)); 662public static implicit operator Decimal128(long value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, long>(value)); 668public static implicit operator Decimal128(ulong value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128, ulong>(value)); 673public static implicit operator Decimal128(decimal value) => new Decimal128(Number.ConvertDecimalToDecimalIeee754<Decimal128, UInt128>(value)); 681return Number.EqualsDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 699return Number.LessThanDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 708return Number.GreaterThanDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 717return Number.LessThanOrEqualDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 726return Number.GreaterThanOrEqualDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)); 737return Number.TryParseDecimalIeee754<char, Decimal128, UInt128>(s.AsSpan(), style | Number.AllowTrailingInvalidCharacters, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK; 744return Number.TryParseDecimalIeee754<char, Decimal128, UInt128>(s, style | Number.AllowTrailingInvalidCharacters, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK; 751return Number.TryParseDecimalIeee754<byte, Decimal128, UInt128>(utf8Text, style | Number.AllowTrailingInvalidCharacters, NumberFormatInfo.GetInstance(provider), out result, out bytesConsumed) == Number.ParsingStatus.OK; 766return Number.ParseDecimalIeee754<byte, Decimal128, UInt128>(utf8Text, style, NumberFormatInfo.GetInstance(provider)); 773public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Decimal128 result) => Number.TryParseDecimalIeee754<byte, Decimal128, UInt128>(utf8Text, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK; 795public static Decimal128 Ceiling(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToPositiveInfinity)); 806public static Decimal128 Floor(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToNegativeInfinity)); 809public static Decimal128 Round(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToEven)); 812public static Decimal128 Round(Decimal128 x, int digits) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), digits, MidpointRounding.ToEven)); 815public static Decimal128 Round(Decimal128 x, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, mode)); 818public static Decimal128 Round(Decimal128 x, int digits, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), digits, mode)); 821public static Decimal128 Truncate(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToZero)); 829int exponent = Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).UnbiasedExponent; 845int IFloatingPoint<Decimal128>.GetSignificandByteCount() => Unsafe.SizeOf<UInt128>(); 850if (BinaryPrimitives.TryWriteInt32BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).UnbiasedExponent)) 863if (BinaryPrimitives.TryWriteInt32LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).UnbiasedExponent)) 876if (BinaryPrimitives.TryWriteUInt128BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).Significand)) 878bytesWritten = Unsafe.SizeOf<UInt128>(); 889if (BinaryPrimitives.TryWriteUInt128LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new UInt128(_upper, _lower)).Significand)) 891bytesWritten = Unsafe.SizeOf<UInt128>(); 904public static Decimal128 Acos(Decimal128 x) => new Decimal128(Number.AcosDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 907public static Decimal128 AcosPi(Decimal128 x) => new Decimal128(Number.AcosPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 910public static Decimal128 Acosh(Decimal128 x) => new Decimal128(Number.AcoshDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 913public static Decimal128 Asin(Decimal128 x) => new Decimal128(Number.AsinDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 916public static Decimal128 AsinPi(Decimal128 x) => new Decimal128(Number.AsinPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 919public static Decimal128 Asinh(Decimal128 x) => new Decimal128(Number.AsinhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 922public static Decimal128 Atan(Decimal128 x) => new Decimal128(Number.AtanDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 925public static Decimal128 Atan2(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2DecimalIeee754<Decimal128, UInt128>(new UInt128(y._upper, y._lower), new UInt128(x._upper, x._lower))); 928public static Decimal128 Atan2Pi(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2PiDecimalIeee754<Decimal128, UInt128>(new UInt128(y._upper, y._lower), new UInt128(x._upper, x._lower))); 931public static Decimal128 AtanPi(Decimal128 x) => new Decimal128(Number.AtanPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 934public static Decimal128 Atanh(Decimal128 x) => new Decimal128(Number.AtanhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 937public static Decimal128 BitDecrement(Decimal128 x) => new Decimal128(Number.BitDecrementDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 940public static Decimal128 BitIncrement(Decimal128 x) => new Decimal128(Number.BitIncrementDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 943public static Decimal128 Cbrt(Decimal128 x) => new Decimal128(Number.CbrtDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 946public static Decimal128 Cos(Decimal128 x) => new Decimal128(Number.CosDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 949public static Decimal128 CosPi(Decimal128 x) => new Decimal128(Number.CosPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 952public static Decimal128 Cosh(Decimal128 x) => new Decimal128(Number.CoshDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 955public static Decimal128 Exp(Decimal128 x) => new Decimal128(Number.ExpDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 958public static Decimal128 Exp10(Decimal128 x) => new Decimal128(Number.Exp10DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 961public static Decimal128 Exp10M1(Decimal128 x) => new Decimal128(Number.Exp10M1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 964public static Decimal128 Exp2(Decimal128 x) => new Decimal128(Number.Exp2DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 967public static Decimal128 Exp2M1(Decimal128 x) => new Decimal128(Number.Exp2M1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 970public static Decimal128 ExpM1(Decimal128 x) => new Decimal128(Number.ExpM1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 973public static Decimal128 FusedMultiplyAdd(Decimal128 left, Decimal128 right, Decimal128 addend) => new Decimal128(Number.FusedMultiplyAddDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower), new UInt128(addend._upper, addend._lower))); 976public static Decimal128 Hypot(Decimal128 x, Decimal128 y) => new Decimal128(Number.HypotDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 979public static Decimal128 Ieee754Remainder(Decimal128 left, Decimal128 right) => new Decimal128(Number.Ieee754RemainderDecimalIeee754<Decimal128, UInt128>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower))); 982public static int ILogB(Decimal128 x) => Number.ILogBDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 988public static Decimal128 Log(Decimal128 x) => new Decimal128(Number.LogDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 991public static Decimal128 Log(Decimal128 x, Decimal128 newBase) => new Decimal128(Number.LogDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(newBase._upper, newBase._lower))); 994public static Decimal128 Log10(Decimal128 x) => new Decimal128(Number.Log10DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 997public static Decimal128 Log10P1(Decimal128 x) => new Decimal128(Number.Log10P1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1000public static Decimal128 Log2(Decimal128 x) => new Decimal128(Number.Log2DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1003public static Decimal128 Log2P1(Decimal128 x) => new Decimal128(Number.Log2P1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1006public static Decimal128 LogP1(Decimal128 x) => new Decimal128(Number.LogP1DecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1009public static Decimal128 Pow(Decimal128 x, Decimal128 y) => new Decimal128(Number.PowDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1018public static Decimal128 RootN(Decimal128 x, int n) => new Decimal128(Number.RootNDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), n)); 1021public static Decimal128 ScaleB(Decimal128 x, int n) => new Decimal128(Number.ScaleBDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), n)); 1024public static Decimal128 Sin(Decimal128 x) => new Decimal128(Number.SinDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1029(UInt128 sin, UInt128 cos) = Number.SinCosDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 1036(UInt128 sin, UInt128 cos) = Number.SinCosPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower)); 1041public static Decimal128 SinPi(Decimal128 x) => new Decimal128(Number.SinPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1044public static Decimal128 Sinh(Decimal128 x) => new Decimal128(Number.SinhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1047public static Decimal128 Sqrt(Decimal128 x) => new Decimal128(Number.SqrtDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1050public static Decimal128 Tan(Decimal128 x) => new Decimal128(Number.TanDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1053public static Decimal128 TanPi(Decimal128 x) => new Decimal128(Number.TanPiDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1056public static Decimal128 Tanh(Decimal128 x) => new Decimal128(Number.TanhDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1062public static Decimal128 Quantize(Decimal128 x, Decimal128 y) => new Decimal128(Number.QuantizeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1067public static Decimal128 GetQuantum(Decimal128 x) => new Decimal128(Number.QuantumDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower))); 1073public static bool HaveSameQuantum(Decimal128 x, Decimal128 y) => Number.SameQuantumDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)); 1078public static Decimal128 Abs(Decimal128 value) => new Decimal128(Number.AbsDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower))); 1123public static bool IsInteger(Decimal128 value) => Number.IsIntegerDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1128public static bool IsEvenInteger(Decimal128 value) => Number.IsEvenIntegerDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1133public static bool IsOddInteger(Decimal128 value) => Number.IsOddIntegerDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1138public static bool IsNormal(Decimal128 value) => Number.IsNormalDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1143public static bool IsSubnormal(Decimal128 value) => Number.IsSubnormalDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1149public static Decimal128 MaxMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1155public static Decimal128 MaxMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1161public static Decimal128 MinMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1167public static Decimal128 MinMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1210public static Decimal128 CopySign(Decimal128 value, Decimal128 sign) => new Decimal128(Number.CopySignDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), new UInt128(sign._upper, sign._lower))); 1216public static Decimal128 Max(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1222public static Decimal128 MaxNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNativeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1228public static Decimal128 MaxNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1234public static Decimal128 Min(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1240public static Decimal128 MinNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNativeDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1246public static Decimal128 MinNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNumberDecimalIeee754<Decimal128, UInt128>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower))); 1252public static int Sign(Decimal128 value) => Number.SignDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1258static bool INumberBase<Decimal128>.IsCanonical(Decimal128 value) => Number.IsCanonicalDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower), nanReservedMask: new UInt128(0x01FF_C000_0000_0000, 0x0000_0000_0000_0000), nanPayloadMask: NaNPayloadMask, maxNaNPayload: new UInt128(0x0000_314D_C644_8D93, 0x38C1_5B09_FFFF_FFFF)); 1267static bool INumberBase<Decimal128>.IsZero(Decimal128 value) => Number.IsZeroDecimalIeee754<Decimal128, UInt128>(new UInt128(value._upper, value._lower)); 1402else if (typeof(TOther) == typeof(UInt128)) 1404result = (Decimal128)(UInt128)(object)value; 1522else if (typeof(TOther) == typeof(UInt128)) 1524UInt128 actualResult = checked((UInt128)value); 1644else if (typeof(TOther) == typeof(UInt128)) 1646result = (TOther)(object)(UInt128)value; 1700private static readonly UInt128[] UInt128Powers10 = 1739static string IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.ToDecStr(UInt128 significand) 1744static unsafe UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NumberToSignificand(ref Number.NumberBuffer number, int digits) 1757static Decimal128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.Construct(UInt128 value) => new Decimal128(value); 1759static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.ConvertToExponent(UInt128 value) => (int)value; 1761static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.Power10(int exponent) => UInt128Powers10[exponent]; 1763static (UInt128 Quotient, UInt128 Remainder) IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.DivRemPow10(UInt128 value, int exponent) 1765UInt128 power = UInt128Powers10[exponent]; 1766return UInt128.DivRem(value, power); 1769static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.CountDigits(UInt128 significand) => FormattingHelpers.CountDigits(significand); 1771static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.Precision => Precision; 1773static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.BufferLength => Number.Decimal128NumberBufferLength; 1775static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MaxExponent => MaxExponent; 1777static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MinExponent => MinExponent; 1779static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MaxAdjustedExponent => MaxExponent - Precision + 1; 1781static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MinAdjustedExponent => MinExponent - Precision + 1; 1783static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.PositiveInfinity => PositiveInfinityValue; 1785static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NegativeInfinity => NegativeInfinityValue; 1787static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.Zero => ZeroValue; 1789static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NaN => QuietNaNValue; 1791static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MostSignificantBitOfSignificandMask => new UInt128(0x0002_0000_0000_0000, 0); 1793static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NaNMask => new UInt128(NaNMaskUpper, 0); 1795static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.SNaNMask => new UInt128(SNaNMaskUpper, 0); 1797static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NaNPayloadMask => NaNPayloadMask; 1799static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.SignMask => new UInt128(SignMaskUpper, 0); 1801static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G0G1Mask => new UInt128(0x6000_0000_0000_0000, 0); 1803static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.ExponentBias => ExponentBias; 1805static int IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NumberBitsSignificand => 110; 1807static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G0ToGwPlus1ExponentMask => new UInt128(0x7FFE_0000_0000_0000, 0); 1809static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G2ToGwPlus3ExponentMask => new UInt128(0x1FFF_8000_0000_0000, 0); 1811static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.GwPlus2ToGwPlus4SignificandMask => new UInt128(0x0001_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1813static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.GwPlus4SignificandMask => new UInt128(0x0000_7FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1815static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MaxSignificand => new UInt128(upper: 0x0001_ED09_BEAD_87C0, lower: 0x378D_8E63_FFFF_FFFF); // 9_999_999_999_999_999_999_999_999_999_999_999; 1817static bool IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.IsNaN(UInt128 decimalBits) => IsNaN(new Decimal128(decimalBits)); 1819static bool IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.IsNegative(UInt128 decimalBits) => IsNegative(new Decimal128(decimalBits)); 1821static bool IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.IsFinite(UInt128 decimalBits) => IsFinite(new Decimal128(decimalBits)); 1823static bool IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.IsInfinity(UInt128 decimalBits) => IsInfinity(new Decimal128(decimalBits)); 1825static bool IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.IsPositiveInfinity(UInt128 decimalBits) => IsPositiveInfinity(new Decimal128(decimalBits)); 1827static bool IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.IsNegativeInfinity(UInt128 decimalBits) => IsNegativeInfinity(new Decimal128(decimalBits)); 1829static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.EncodeExponentToG0ThroughGwPlus1(uint biasedExponent) 1831return ((UInt128)biasedExponent) << 113; 1834static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.EncodeExponentToG2ThroughGwPlus3(uint biasedExponent) 1836return ((UInt128)biasedExponent) << 111;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal32.cs (21)
437/// <summary>Explicitly converts a <see cref="System.UInt128" /> value to its nearest representable <see cref="System.Numerics.Decimal32" /> value.</summary> 441public static explicit operator Decimal32(UInt128 value) => new Decimal32(Number.ConvertIntegerToDecimalIeee754<Decimal32, uint, UInt128>(value)); 466public static explicit operator Decimal32(Decimal128 value) => new Decimal32(Number.ConvertDecimalIeee754<Decimal128, UInt128, Decimal32, uint>(new UInt128(value._upper, value._lower))); 619/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal32" /> value to its nearest representable <see cref="System.UInt128" /> value.</summary> 621/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt128" /> value.</returns> 623public static explicit operator UInt128(Decimal32 value) => Number.ConvertDecimalIeee754ToInteger<Decimal32, uint, UInt128>(value._value, isChecked: false); 625/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal32" /> value to its nearest representable <see cref="System.UInt128" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary> 627/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt128" /> value.</returns> 628/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.UInt128" />.</exception> 630public static explicit operator checked UInt128(Decimal32 value) => Number.ConvertDecimalIeee754ToInteger<Decimal32, uint, UInt128>(value._value, isChecked: true); 696public static implicit operator Decimal128(Decimal32 value) => new Decimal128(Number.ConvertDecimalIeee754<Decimal32, uint, Decimal128, UInt128>(value._value)); 1425else if (typeof(TOther) == typeof(UInt128)) 1427result = (Decimal32)(UInt128)(object)value; 1545else if (typeof(TOther) == typeof(UInt128)) 1547UInt128 actualResult = checked((UInt128)value); 1667else if (typeof(TOther) == typeof(UInt128)) 1669result = (TOther)(object)(UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal64.cs (21)
427/// <summary>Explicitly converts a <see cref="System.UInt128" /> value to its nearest representable <see cref="System.Numerics.Decimal64" /> value.</summary> 431public static explicit operator Decimal64(UInt128 value) => new Decimal64(Number.ConvertIntegerToDecimalIeee754<Decimal64, ulong, UInt128>(value)); 451public static explicit operator Decimal64(Decimal128 value) => new Decimal64(Number.ConvertDecimalIeee754<Decimal128, UInt128, Decimal64, ulong>(new UInt128(value._upper, value._lower))); 604/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal64" /> value to its nearest representable <see cref="System.UInt128" /> value.</summary> 606/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt128" /> value.</returns> 608public static explicit operator UInt128(Decimal64 value) => Number.ConvertDecimalIeee754ToInteger<Decimal64, ulong, UInt128>(value._value, isChecked: false); 610/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal64" /> value to its nearest representable <see cref="System.UInt128" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary> 612/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.UInt128" /> value.</returns> 613/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.UInt128" />.</exception> 615public static explicit operator checked UInt128(Decimal64 value) => Number.ConvertDecimalIeee754ToInteger<Decimal64, ulong, UInt128>(value._value, isChecked: true); 687public static implicit operator Decimal128(Decimal64 value) => new Decimal128(Number.ConvertDecimalIeee754<Decimal64, ulong, Decimal128, UInt128>(value._value)); 1416else if (typeof(TOther) == typeof(UInt128)) 1418result = (Decimal64)(UInt128)(object)value; 1536else if (typeof(TOther) == typeof(UInt128)) 1538UInt128 actualResult = checked((UInt128)value); 1658else if (typeof(TOther) == typeof(UInt128)) 1660result = (TOther)(object)(UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (1)
86return CompareDecimal<Decimal128, UInt128>(new UInt128(xValue._upper, xValue._lower), new UInt128(yValue._upper, yValue._lower));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
322typeof(T) == typeof(UInt128))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (24)
420/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="UInt128" /> value.</summary> 422/// <returns><paramref name="value" /> converted to its nearest representable <see cref="UInt128" /> value.</returns> 425public static explicit operator UInt128(NFloat value) => (UInt128)(value._value); 427/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="UInt128" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary> 429/// <returns><paramref name="value" /> converted to its nearest representable <see cref="UInt128" /> value.</returns> 430/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 433public static explicit operator checked UInt128(NFloat value) => checked((UInt128)(value._value)); 499return -(NFloat)(UInt128)(value); 501return (NFloat)(UInt128)(value); 544/// <summary>Explicitly converts <see cref="UInt128"/> to its nearest representable native-sized floating-point value.</summary> 549public static explicit operator NFloat(UInt128 value) => (NFloat)(double)(value); 1434else if (typeof(TOther) == typeof(UInt128)) 1436UInt128 actualValue = (UInt128)(object)value; 1547else if (typeof(TOther) == typeof(UInt128)) 1549UInt128 actualResult = checked((UInt128)value); 1688else if (typeof(TOther) == typeof(UInt128)) 1690UInt128 actualResult = (value >= 340282366920938463463374607431768211455.0) ? UInt128.MaxValue : 1691(value <= 0.0) ? UInt128.MinValue : (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SByte.cs (10)
1124else if (typeof(TOther) == typeof(UInt128)) 1126UInt128 actualResult = checked((UInt128)value); 1192else if (typeof(TOther) == typeof(UInt128)) 1194UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1260else if (typeof(TOther) == typeof(UInt128)) 1262UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Single.cs (6)
1381else if (typeof(TOther) == typeof(UInt128)) 1383UInt128 actualResult = checked((UInt128)value); 1491else if (typeof(TOther) == typeof(UInt128)) 1493UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5595(sizeof(TResult) == sizeof(UInt128) && *(UInt128*)&result == default))
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (361)
20: IBinaryInteger<UInt128>, 21IMinMaxValue<UInt128>, 22IUnsignedNumber<UInt128>, 24IBinaryIntegerParseAndFormatInfo<UInt128> 36/// <summary>Initializes a new instance of the <see cref="UInt128" /> struct.</summary> 53if (value is UInt128 other) 68public int CompareTo(UInt128 value) 87return (obj is UInt128 other) && Equals(other); 91public bool Equals(UInt128 other) 131public static UInt128 Parse(string s) => Parse(s, NumberStyles.Integer, provider: null); 133public static UInt128 Parse(string s, NumberStyles style) => Parse(s, style, provider: null); 135public static UInt128 Parse(string s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); 137public static UInt128 Parse(string s, NumberStyles style, IFormatProvider? provider) 143public static UInt128 Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 146return Number.ParseBinaryInteger<char, UInt128>(s, style, NumberFormatInfo.GetInstance(provider)); 149public static bool TryParse([NotNullWhen(true)] string? s, out UInt128 result) => TryParse(s, NumberStyles.Integer, provider: null, out result); 151public static bool TryParse(ReadOnlySpan<char> s, out UInt128 result) => TryParse(s, NumberStyles.Integer, provider: null, out result); 157public static bool TryParse(ReadOnlySpan<byte> utf8Text, out UInt128 result) => TryParse(utf8Text, NumberStyles.Integer, provider: null, out result); 159public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out UInt128 result) 165public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out UInt128 result) 178public static explicit operator byte(UInt128 value) => (byte)value._lower; 183/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 184public static explicit operator checked byte(UInt128 value) 196public static explicit operator char(UInt128 value) => (char)value._lower; 201/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 202public static explicit operator checked char(UInt128 value) 214public static explicit operator decimal(UInt128 value) 232public static explicit operator double(UInt128 value) 282public static explicit operator Half(UInt128 value) => (Half)(double)(value); 287public static explicit operator short(UInt128 value) => (short)value._lower; 292/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 293public static explicit operator checked short(UInt128 value) 305public static explicit operator int(UInt128 value) => (int)value._lower; 310/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 311public static explicit operator checked int(UInt128 value) 323public static explicit operator long(UInt128 value) => (long)value._lower; 328/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 329public static explicit operator checked long(UInt128 value) 342public static explicit operator Int128(UInt128 value) => new Int128(value._upper, value._lower); 347/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 349public static explicit operator checked Int128(UInt128 value) 361public static explicit operator nint(UInt128 value) => (nint)value._lower; 366/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 367public static explicit operator checked nint(UInt128 value) 380public static explicit operator sbyte(UInt128 value) => (sbyte)value._lower; 385/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 387public static explicit operator checked sbyte(UInt128 value) 399public static explicit operator float(UInt128 value) => (float)(double)(value); 405public static explicit operator ushort(UInt128 value) => (ushort)value._lower; 410/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 412public static explicit operator checked ushort(UInt128 value) 425public static explicit operator uint(UInt128 value) => (uint)value._lower; 430/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 432public static explicit operator checked uint(UInt128 value) 445public static explicit operator ulong(UInt128 value) => value._lower; 450/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 452public static explicit operator checked ulong(UInt128 value) 465public static explicit operator nuint(UInt128 value) => (nuint)value._lower; 470/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 472public static explicit operator checked nuint(UInt128 value) 488public static explicit operator UInt128(decimal value) 502public static explicit operator UInt128(double value) 521/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 522public static explicit operator checked UInt128(double value) 537internal static UInt128 ToUInt128(double value) 559UInt128 result = new UInt128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000); 573public static explicit operator UInt128(short value) 582/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 583public static explicit operator checked UInt128(short value) 595public static explicit operator UInt128(int value) 604/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 605public static explicit operator checked UInt128(int value) 617public static explicit operator UInt128(long value) 626/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 627public static explicit operator checked UInt128(long value) 639public static explicit operator UInt128(nint value) 648/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 649public static explicit operator checked UInt128(nint value) 662public static explicit operator UInt128(sbyte value) 671/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 673public static explicit operator checked UInt128(sbyte value) 685public static explicit operator UInt128(float value) => (UInt128)(double)(value); 690/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 691public static explicit operator checked UInt128(float value) => checked((UInt128)(double)(value)); 700public static implicit operator UInt128(byte value) => new UInt128(0, value); 705public static implicit operator UInt128(char value) => new UInt128(0, value); 711public static implicit operator UInt128(ushort value) => new UInt128(0, value); 717public static implicit operator UInt128(uint value) => new UInt128(0, value); 723public static implicit operator UInt128(ulong value) => new UInt128(0, value); 729public static implicit operator UInt128(nuint value) => new UInt128(0, value); 736public static UInt128 operator +(UInt128 left, UInt128 right) 749public static UInt128 operator checked +(UInt128 left, UInt128 right) 766static UInt128 IAdditiveIdentity<UInt128, UInt128>.AdditiveIdentity => default; 773public static (UInt128 Quotient, UInt128 Remainder) DivRem(UInt128 left, UInt128 right) 789static (ulong Quotient, UInt128 Remainder) DivideSlow(UInt128 left, UInt128 right) 836UInt128 valMiLo = new UInt128(valMi, valLo); 846UInt128 divisor = new UInt128(divHi, divLo); 847UInt128 chkMiLo = new UInt128(chkMi, chkLo); 860UInt128 rem = valMiLo - chkMiLo; 866static (UInt128 Quotient, ulong Remainder) Divide128BitsBy64Bits(UInt128 left, ulong divisor) 1005public static UInt128 LeadingZeroCount(UInt128 value) 1010private static int LeadingZeroCountAsInt32(UInt128 value) 1020public static UInt128 Log10(UInt128 value) 1036internal static ReadOnlySpan<UInt128> PowersOf10 => s_powersOf10; 1038private static readonly UInt128[] s_powersOf10 = 1082public static UInt128 PopCount(UInt128 value) 1086public static UInt128 RotateLeft(UInt128 value, int rotateAmount) 1090public static UInt128 RotateRight(UInt128 value, int rotateAmount) 1094public static UInt128 TrailingZeroCount(UInt128 value) 1104static bool IBinaryInteger<UInt128>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out UInt128 value) 1106UInt128 result = default; 1152static bool IBinaryInteger<UInt128>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out UInt128 value) 1154UInt128 result = default; 1191UInt128 part = source[i]; 1203int IBinaryInteger<UInt128>.GetShortestBitLength() 1209int IBinaryInteger<UInt128>.GetByteCount() => Size; 1212bool IBinaryInteger<UInt128>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten) 1225bool IBinaryInteger<UInt128>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten) 1242static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1245public static bool IsPow2(UInt128 value) => PopCount(value) == 1U; 1248public static UInt128 Log2(UInt128 value) 1262public static UInt128 operator &(UInt128 left, UInt128 right) => new UInt128(left._upper & right._upper, left._lower & right._lower); 1265public static UInt128 operator |(UInt128 left, UInt128 right) => new UInt128(left._upper | right._upper, left._lower | right._lower); 1268public static UInt128 operator ^(UInt128 left, UInt128 right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower); 1271public static UInt128 operator ~(UInt128 value) => new UInt128(~value._upper, ~value._lower); 1278public static bool operator <(UInt128 left, UInt128 right) 1285public static bool operator <=(UInt128 left, UInt128 right) 1292public static bool operator >(UInt128 left, UInt128 right) 1299public static bool operator >=(UInt128 left, UInt128 right) 1310public static UInt128 operator --(UInt128 value) => value - One; 1313public static UInt128 operator checked --(UInt128 value) => checked(value - One); 1320public static UInt128 operator /(UInt128 left, UInt128 right) 1324public static UInt128 operator checked /(UInt128 left, UInt128 right) => left / right; 1331public static bool operator ==(UInt128 left, UInt128 right) => (left._lower == right._lower) && (left._upper == right._upper); 1334public static bool operator !=(UInt128 left, UInt128 right) => (left._lower != right._lower) || (left._upper != right._upper); 1341public static UInt128 operator ++(UInt128 value) => value + One; 1344public static UInt128 operator checked ++(UInt128 value) => checked(value + One); 1351public static UInt128 MinValue => new UInt128(0, 0); 1354public static UInt128 MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1361public static UInt128 operator %(UInt128 left, UInt128 right) 1369static UInt128 IMultiplicativeIdentity<UInt128, UInt128>.MultiplicativeIdentity => One; 1376public static UInt128 operator *(UInt128 left, UInt128 right) 1384public static UInt128 operator checked *(UInt128 left, UInt128 right) 1386UInt128 upper = BigMul(left, right, out UInt128 lower); 1401public static UInt128 BigMul(UInt128 left, UInt128 right, out UInt128 lower) 1415UInt128 mull = Math.BigMul(al, bl); 1416UInt128 t = Math.BigMul(ah, bl) + mull._upper; 1417UInt128 tl = Math.BigMul(al, bh) + t._lower; 1428public static UInt128 Clamp(UInt128 value, UInt128 min, UInt128 max) 1448static UInt128 INumber<UInt128>.CopySign(UInt128 value, UInt128 sign) => value; 1451public static UInt128 Max(UInt128 x, UInt128 y) => (x >= y) ? x : y; 1454static UInt128 INumber<UInt128>.MaxNumber(UInt128 x, UInt128 y) => Max(x, y); 1457public static UInt128 Min(UInt128 x, UInt128 y) => (x <= y) ? x : y; 1460static UInt128 INumber<UInt128>.MinNumber(UInt128 x, UInt128 y) => Min(x, y); 1463public static int Sign(UInt128 value) => (value == 0U) ? 0 : 1; 1470public static UInt128 One => new UInt128(0, 1); 1473static int INumberBase<UInt128>.Radix => 2; 1476public static UInt128 Zero => default; 1479static UInt128 INumberBase<UInt128>.Abs(UInt128 value) => value; 1483public static UInt128 CreateChecked<TOther>(TOther value) 1486UInt128 result; 1488if (typeof(TOther) == typeof(UInt128)) 1490result = (UInt128)(object)value; 1502public static UInt128 CreateSaturating<TOther>(TOther value) 1505UInt128 result; 1507if (typeof(TOther) == typeof(UInt128)) 1509result = (UInt128)(object)value; 1521public static UInt128 CreateTruncating<TOther>(TOther value) 1524UInt128 result; 1526if (typeof(TOther) == typeof(UInt128)) 1528result = (UInt128)(object)value; 1539static bool INumberBase<UInt128>.IsCanonical(UInt128 value) => true; 1542static bool INumberBase<UInt128>.IsComplexNumber(UInt128 value) => false; 1545public static bool IsEvenInteger(UInt128 value) => (value._lower & 1) == 0; 1548static bool INumberBase<UInt128>.IsFinite(UInt128 value) => true; 1551static bool INumberBase<UInt128>.IsImaginaryNumber(UInt128 value) => false; 1554static bool INumberBase<UInt128>.IsInfinity(UInt128 value) => false; 1557static bool INumberBase<UInt128>.IsInteger(UInt128 value) => true; 1560static bool INumberBase<UInt128>.IsNaN(UInt128 value) => false; 1563static bool INumberBase<UInt128>.IsNegative(UInt128 value) => false; 1566static bool INumberBase<UInt128>.IsNegativeInfinity(UInt128 value) => false; 1569static bool INumberBase<UInt128>.IsNormal(UInt128 value) => value != 0U; 1572public static bool IsOddInteger(UInt128 value) => (value._lower & 1) != 0; 1575static bool INumberBase<UInt128>.IsPositive(UInt128 value) => true; 1578static bool INumberBase<UInt128>.IsPositiveInfinity(UInt128 value) => false; 1581static bool INumberBase<UInt128>.IsRealNumber(UInt128 value) => true; 1584static bool INumberBase<UInt128>.IsSubnormal(UInt128 value) => false; 1587static bool INumberBase<UInt128>.IsZero(UInt128 value) => (value == 0U); 1590static UInt128 INumberBase<UInt128>.MaxMagnitude(UInt128 x, UInt128 y) => Max(x, y); 1593static UInt128 INumberBase<UInt128>.MaxMagnitudeNumber(UInt128 x, UInt128 y) => Max(x, y); 1596static UInt128 INumberBase<UInt128>.MinMagnitude(UInt128 x, UInt128 y) => Min(x, y); 1599static UInt128 INumberBase<UInt128>.MinMagnitudeNumber(UInt128 x, UInt128 y) => Min(x, y); 1602static UInt128 INumberBase<UInt128>.MultiplyAddEstimate(UInt128 left, UInt128 right, UInt128 addend) => (left * right) + addend; 1606static bool INumberBase<UInt128>.TryConvertFromChecked<TOther>(TOther value, out UInt128 result) => TryConvertFromChecked(value, out result); 1609private static bool TryConvertFromChecked<TOther>(TOther value, out UInt128 result) 1636result = checked((UInt128)actualValue); 1672static bool INumberBase<UInt128>.TryConvertFromSaturating<TOther>(TOther value, out UInt128 result) => TryConvertFromSaturating(value, out result); 1675private static bool TryConvertFromSaturating<TOther>(TOther value, out UInt128 result) 1702result = (actualValue < 0) ? MinValue : (UInt128)actualValue; 1738static bool INumberBase<UInt128>.TryConvertFromTruncating<TOther>(TOther value, out UInt128 result) => TryConvertFromTruncating(value, out result); 1741private static bool TryConvertFromTruncating<TOther>(TOther value, out UInt128 result) 1768result = (actualValue < 0) ? MinValue : (UInt128)actualValue; 1804static bool INumberBase<UInt128>.TryConvertToChecked<TOther>(UInt128 value, [MaybeNullWhen(false)] out TOther result) 1878static bool INumberBase<UInt128>.TryConvertToSaturating<TOther>(UInt128 value, [MaybeNullWhen(false)] out TOther result) 1958static bool INumberBase<UInt128>.TryConvertToTruncating<TOther>(UInt128 value, [MaybeNullWhen(false)] out TOther result) 2031public static bool TryParsePartial([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out UInt128 result, out int charsConsumed) 2038public static bool TryParsePartial(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out UInt128 result, out int charsConsumed) 2045public static bool TryParsePartial(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out UInt128 result, out int bytesConsumed) 2056public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out UInt128 result) => TryParse(s, NumberStyles.Integer, provider, out result); 2063public static UInt128 operator <<(UInt128 value, int shiftAmount) 2096public static UInt128 operator >>(UInt128 value, int shiftAmount) => value >>> shiftAmount; 2099public static UInt128 operator >>>(UInt128 value, int shiftAmount) 2136public static UInt128 Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); 2139public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out UInt128 result) => TryParse(s, NumberStyles.Integer, provider, out result); 2146public static UInt128 operator -(UInt128 left, UInt128 right) 2159public static UInt128 operator checked -(UInt128 left, UInt128 right) 2176public static UInt128 operator -(UInt128 value) => Zero - value; 2179public static UInt128 operator checked -(UInt128 value) => checked(Zero - value); 2186public static UInt128 operator +(UInt128 value) => value; 2193public static UInt128 Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 2196return Number.ParseBinaryInteger<byte, UInt128>(utf8Text, style, NumberFormatInfo.GetInstance(provider)); 2200public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out UInt128 result) 2207public static UInt128 Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider); 2210public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out UInt128 result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result); 2216static bool IBinaryIntegerParseAndFormatInfo<UInt128>.IsSigned => false; 2218static int IBinaryIntegerParseAndFormatInfo<UInt128>.MaxDigitCount => 39; // 340_282_366_920_938_463_463_374_607_431_768_211_455 2220static int IBinaryIntegerParseAndFormatInfo<UInt128>.MaxHexDigitCount => 32; // 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF 2222static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999); 2224static string IBinaryIntegerParseAndFormatInfo<UInt128>.OverflowMessage => SR.Overflow_UInt128; 2226static bool IBinaryIntegerParseAndFormatInfo<UInt128>.IsGreaterThanAsUnsigned(UInt128 left, UInt128 right) => left > right; 2228static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MultiplyBy10(UInt128 value) => value * 10; 2230static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MultiplyBy16(UInt128 value) => value * 16;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt16.cs (9)
731else if (typeof(TOther) == typeof(UInt128)) 733UInt128 actualValue = (UInt128)(object)value; 798else if (typeof(TOther) == typeof(UInt128)) 800UInt128 actualValue = (UInt128)(object)value; 865else if (typeof(TOther) == typeof(UInt128)) 867UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
796else if (typeof(TOther) == typeof(UInt128)) 798UInt128 actualValue = (UInt128)(object)value; 863else if (typeof(TOther) == typeof(UInt128)) 865UInt128 actualValue = (UInt128)(object)value; 930else if (typeof(TOther) == typeof(UInt128)) 932UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt64.cs (10)
51public static UInt128 BigMul(ulong left, ulong right) => Math.BigMul(left, right); 803else if (typeof(TOther) == typeof(UInt128)) 805UInt128 actualValue = (UInt128)(object)value; 870else if (typeof(TOther) == typeof(UInt128)) 872UInt128 actualValue = (UInt128)(object)value; 937else if (typeof(TOther) == typeof(UInt128)) 939UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (10)
186UInt128 result = ulong.BigMul(left, right); 804else if (typeof(TOther) == typeof(UInt128)) 806UInt128 actualValue = (UInt128)(object)value; 871else if (typeof(TOther) == typeof(UInt128)) 873UInt128 actualValue = (UInt128)(object)value; 938else if (typeof(TOther) == typeof(UInt128)) 940UInt128 actualValue = (UInt128)(object)value;
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
889[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.UInt128))]
System.Runtime.Numerics (93)
System\Number.BigInteger.cs (4)
596UInt128 p = (UInt128)bits[i] * multiplier + carry; 1541UInt128 p = (UInt128)multiplier * bits2[i] + carry;
System\Numerics\BigInteger.cs (37)
2326UInt128 uu; 2330uu = len > 1 ? new UInt128(value._bits[1], value._bits[0]) : (UInt128)(ulong)value._bits[0]; 2342? (UInt128)((ulong)(uint)value._bits[1] << 32 | (uint)value._bits[0]) 2343: (UInt128)(uint)value._bits[0]; 2435/// <summary>Explicitly converts a big integer to a <see cref="UInt128" /> value.</summary> 2437/// <returns><paramref name="value" /> converted to <see cref="UInt128" /> value.</returns> 2439public static explicit operator UInt128(BigInteger value) 2443return checked((UInt128)value._sign); 2458: (UInt128)(ulong)value._bits[0]; 2551UInt128 x; 2554x = (UInt128)(-value); 2559x = (UInt128)value; 2616/// <summary>Implicitly converts a <see cref="UInt128" /> value to a big integer.</summary> 2620public static implicit operator BigInteger(UInt128 value) 4371else if (typeof(TOther) == typeof(UInt128)) 4373UInt128 actualValue = (UInt128)(object)value; 4494else if (typeof(TOther) == typeof(UInt128)) 4496UInt128 actualValue = (UInt128)(object)value; 4617else if (typeof(TOther) == typeof(UInt128)) 4619UInt128 actualValue = (UInt128)(object)value; 4742else if (typeof(TOther) == typeof(UInt128)) 4744UInt128 actualResult = checked((UInt128)value); 4939else if (typeof(TOther) == typeof(UInt128)) 4941UInt128 actualResult = (value >= UInt128.MaxValue) ? UInt128.MaxValue : 4942IsNegative(value) ? UInt128.MinValue : (UInt128)value; 5147UInt128 bits = new(upperBits, lowerBits); 5301else if (typeof(TOther) == typeof(UInt128)) 5303UInt128 actualResult; 5341UInt128 bits = new(upperBits, lowerBits); 5352actualResult = (UInt128)(Int128)(long)value._sign;
System\Numerics\BigIntegerCalculator.PowMod.cs (10)
190UInt128 prod = (UInt128)(ulong)result * (ulong)value; 195UInt128 sq = (UInt128)(ulong)value * (ulong)value; 234UInt128 prod = (UInt128)(ulong)result * (ulong)value; 240UInt128 sq = (UInt128)(ulong)value * (ulong)value; 692UInt128 p = (UInt128)m * modulus[j] + value[i + j] + carry;
System\Numerics\BigIntegerCalculator.SquMul.cs (7)
164UInt128 carry = 0; 168UInt128 digit1 = (UInt128)(ulong)bits[i + j] + carry; 169UInt128 digit2 = (UInt128)(ulong)value[j] * (ulong)v; 177UInt128 digits = (UInt128)(ulong)v * (ulong)v + carry;
System\Numerics\BigIntegerCalculator.Utils.cs (33)
198UInt128 value = ((UInt128)(ulong)hi << 64) | (ulong)lo; 199UInt128 digit = value / (ulong)divisor; 230UInt128 p0 = (UInt128)(ulong)left[i] * (ulong)multiplier + (ulong)carry; 233UInt128 p1 = (UInt128)(ulong)left[i + 1] * (ulong)multiplier + (ulong)(p0 >> 64); 236UInt128 p2 = (UInt128)(ulong)left[i + 2] * (ulong)multiplier + (ulong)(p1 >> 64); 239UInt128 p3 = (UInt128)(ulong)left[i + 3] * (ulong)multiplier + (ulong)(p2 >> 64); 247UInt128 product = (UInt128)(ulong)left[i] * (ulong)multiplier + (ulong)carry; 284UInt128 p0 = (UInt128)(ulong)left[i] * (ulong)multiplier + (ulong)result[i] + (ulong)carry; 287UInt128 p1 = (UInt128)(ulong)left[i + 1] * (ulong)multiplier + (ulong)result[i + 1] + (ulong)(p0 >> 64); 290UInt128 p2 = (UInt128)(ulong)left[i + 2] * (ulong)multiplier + (ulong)result[i + 2] + (ulong)(p1 >> 64); 293UInt128 p3 = (UInt128)(ulong)left[i + 3] * (ulong)multiplier + (ulong)result[i + 3] + (ulong)(p2 >> 64); 301UInt128 product = (UInt128)(ulong)left[i] * (ulong)multiplier + (ulong)result[i] + (ulong)carry; 336UInt128 prod0 = (UInt128)(ulong)right[i] * (ulong)multiplier + (ulong)carry; 343UInt128 prod1 = (UInt128)(ulong)right[i + 1] * (ulong)multiplier + (ulong)hi0; 350UInt128 prod2 = (UInt128)(ulong)right[i + 2] * (ulong)multiplier + (ulong)hi1; 357UInt128 prod3 = (UInt128)(ulong)right[i + 3] * (ulong)multiplier + (ulong)hi2; 369UInt128 product = (UInt128)(ulong)right[i] * (ulong)multiplier + (ulong)carry;
System\Numerics\Complex.cs (2)
373/// <summary>Explicitly converts a <see cref="UInt128" /> value to a double-precision complex number.</summary> 377public static explicit operator Complex(UInt128 value)
System.Text.Json (17)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
102if (type == typeof(Half) || type == typeof(UInt128) || type == typeof(Int128))
System\Text\Json\Serialization\Converters\Value\UInt128Converter.cs (12)
12internal sealed class UInt128Converter : JsonPrimitiveConverter<UInt128> 21public override UInt128 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 36public override void Write(Utf8JsonWriter writer, UInt128 value, JsonSerializerOptions options) 47private static unsafe UInt128 ReadCore(ref Utf8JsonReader reader) 57if (!UInt128.TryParse(buffer.Slice(0, written), CultureInfo.InvariantCulture, out UInt128 result)) 70private static unsafe void WriteCore(Utf8JsonWriter writer, UInt128 value) 77internal override UInt128 ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 83internal override unsafe void WriteAsPropertyNameCore(Utf8JsonWriter writer, UInt128 value, JsonSerializerOptions options, bool isWritingExtensionDataProperty) 90internal override UInt128 ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options) 106internal override unsafe void WriteNumberWithCustomHandling(Utf8JsonWriter writer, UInt128 value, JsonNumberHandling handling) 133UInt128 value, out int written)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
124/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="UInt128"/> values. 128public static JsonConverter<UInt128> UInt128Converter => s_uint128Converter ??= new UInt128Converter(); 129private static JsonConverter<UInt128>? s_uint128Converter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
726potentialNumberType == typeof(UInt128) ||