118 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 (100)
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.cs (2)
1368var significand = new UInt128(value._hi32, value._lo64); 1601result = (actualValue >= new UInt128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? MaxValue : (decimal)actualValue;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (2)
428public static explicit operator UInt128(Int128 value) => new UInt128(value._upper, value._lower); 441return new UInt128(value._upper, value._lower);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
288return new UInt128(high, low);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (1)
2708UInt128 divisor = new UInt128(0, 10_000_000_000_000_000_000);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (92)
502return new UInt128(value.High, value.Low64); 565UInt128 result = new UInt128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000); 582return new UInt128((ulong)(lower >> 63), (ulong)lower); 595return new UInt128(0, (ushort)value); 604return new UInt128((ulong)(lower >> 63), (ulong)lower); 617return new UInt128(0, (uint)value); 626return new UInt128((ulong)(lower >> 63), (ulong)lower); 639return new UInt128(0, (ulong)value); 648return new UInt128((ulong)(lower >> 63), (ulong)lower); 661return new UInt128(0, (nuint)value); 671return new UInt128((ulong)(lower >> 63), (ulong)lower); 685return new UInt128(0, (byte)value); 706public static implicit operator UInt128(byte value) => new UInt128(0, value); 711public static implicit operator UInt128(char value) => new UInt128(0, value); 717public static implicit operator UInt128(ushort value) => new UInt128(0, value); 723public static implicit operator UInt128(uint value) => new UInt128(0, value); 729public static implicit operator UInt128(ulong value) => new UInt128(0, value); 735public static implicit operator UInt128(nuint value) => new UInt128(0, value); 751return new UInt128(upper, lower); 764return new UInt128(upper, lower); 842UInt128 valMiLo = new UInt128(valMi, valLo); 852UInt128 divisor = new UInt128(divHi, divLo); 853UInt128 chkMiLo = new UInt128(chkMi, chkLo); 900return (new UInt128(highRes, lowRes), remainder); 915return (new UInt128(highRes, lowRes), remainder >> shift); 948Debug.Assert(Math.BigMul(quo, divisor) + rem == (new UInt128(hi, lo))); 991Debug.Assert(new UInt128(valHi, valMiLo) < new UInt128(chkHi, chkLo)); 1004Debug.Assert(new UInt128(valHi, valMiLo) == new UInt128(chkHi, chkLo) + remainder); 1044new UInt128(0, 1UL), 1045new UInt128(0, 10UL), 1046new UInt128(0, 100UL), 1047new UInt128(0, 1_000UL), 1048new UInt128(0, 10_000UL), 1049new UInt128(0, 100_000UL), 1050new UInt128(0, 1_000_000UL), 1051new UInt128(0, 10_000_000UL), 1052new UInt128(0, 100_000_000UL), 1053new UInt128(0, 1_000_000_000UL), 1054new UInt128(0, 10_000_000_000UL), 1055new UInt128(0, 100_000_000_000UL), 1056new UInt128(0, 1_000_000_000_000UL), 1057new UInt128(0, 10_000_000_000_000UL), 1058new UInt128(0, 100_000_000_000_000UL), 1059new UInt128(0, 1_000_000_000_000_000UL), 1060new UInt128(0, 10_000_000_000_000_000UL), 1061new UInt128(0, 100_000_000_000_000_000UL), 1062new UInt128(0, 1_000_000_000_000_000_000UL), 1063new UInt128(0, 10_000_000_000_000_000_000UL), 1064new UInt128(5, 7766279631452241920UL), 1065new UInt128(54, 3875820019684212736UL), 1066new UInt128(542, 1864712049423024128UL), 1067new UInt128(5421, 200376420520689664UL), 1068new UInt128(54210, 2003764205206896640UL), 1069new UInt128(542101, 1590897978359414784UL), 1070new UInt128(5421010, 15908979783594147840UL), 1071new UInt128(54210108, 11515845246265065472UL), 1072new UInt128(542101086, 4477988020393345024UL), 1073new UInt128(5421010862, 7886392056514347008UL), 1074new UInt128(54210108624, 5076944270305263616UL), 1075new UInt128(542101086242, 13875954555633532928UL), 1076new UInt128(5421010862427, 9632337040368467968UL), 1077new UInt128(54210108624275, 4089650035136921600UL), 1078new UInt128(542101086242752, 4003012203950112768UL), 1079new UInt128(5421010862427522, 3136633892082024448UL), 1080new UInt128(54210108624275221, 12919594847110692864UL), 1081new UInt128(542101086242752217, 68739955140067328UL), 1082new UInt128(5421010862427522170, 687399551400673280UL), 1246static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1266public static UInt128 operator &(UInt128 left, UInt128 right) => new UInt128(left._upper & right._upper, left._lower & right._lower); 1269public static UInt128 operator |(UInt128 left, UInt128 right) => new UInt128(left._upper | right._upper, left._lower | right._lower); 1272public static UInt128 operator ^(UInt128 left, UInt128 right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower); 1275public static UInt128 operator ~(UInt128 value) => new UInt128(~value._upper, ~value._lower); 1355public static UInt128 MinValue => new UInt128(0, 0); 1358public static UInt128 MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1384return new UInt128(upper, lower); 1423lower = new UInt128(tl._lower, mull._lower); 1474public static UInt128 One => new UInt128(0, 1); 1907short actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x0000_0000_0000_7FFF)) ? short.MaxValue : (short)value; 1913int actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x0000_0000_7FFF_FFFF)) ? int.MaxValue : (int)value; 1919long actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? long.MaxValue : (long)value; 1925Int128 actualResult = (value >= new UInt128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? Int128.MaxValue : (Int128)value; 1936nint actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? nint.MaxValue : (nint)value; 1943sbyte actualResult = (value >= new UInt128(0x0000_0000_0000_0000, 0x0000_0000_0000_007F)) ? sbyte.MaxValue : (sbyte)value; 2060return new UInt128(upper, 0); 2070return new UInt128(upper, lower); 2096return new UInt128(0, lower); 2106return new UInt128(upper, lower); 2138return new UInt128(upper, lower); 2151return new UInt128(upper, lower); 2205static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
System.Runtime.Numerics (8)
System\Numerics\BigInteger.cs (8)
2163uu = len > 1 ? new UInt128(value._bits[1], value._bits[0]) : (UInt128)(ulong)value._bits[0]; 2167uu = new UInt128( 2265? new UInt128(value._bits[1], value._bits[0]) 2270return new UInt128( 2388else if (x <= new UInt128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) 2459else if (value <= new UInt128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) 4955UInt128 bits = new(upperBits, lowerBits); 5149UInt128 bits = new(upperBits, lowerBits);
862 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)
35typeof(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.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
122public static UInt128 HashToUInt128(ReadOnlySpan<byte> source, long seed = 0) 207public UInt128 GetCurrentHashAsUInt128()
System.Linq (11)
System\Linq\Max.cs (4)
335if (typeof(TSource) == typeof(UInt128) && comparer == Comparer<TSource>.Default) return (TSource)(object)MinMaxInteger<UInt128, MaxCalc<UInt128>>((IEnumerable<UInt128>)source);
System\Linq\Min.cs (4)
314if (typeof(TSource) == typeof(UInt128) && comparer == Comparer<TSource>.Default) return (TSource)(object)MinMaxInteger<UInt128, MinCalc<UInt128>>((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 (675)
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)
732else if (typeof(TOther) == typeof(UInt128)) 734UInt128 actualValue = (UInt128)(object)value; 799else if (typeof(TOther) == typeof(UInt128)) 801UInt128 actualValue = (UInt128)(object)value; 866else if (typeof(TOther) == typeof(UInt128)) 868UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (9)
1591else if (typeof(TOther) == typeof(UInt128)) 1593UInt128 actualValue = (UInt128)(object)value; 1654else if (typeof(TOther) == typeof(UInt128)) 1656UInt128 actualValue = (UInt128)(object)value; 1717else if (typeof(TOther) == typeof(UInt128)) 1719UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (7)
1368var significand = new UInt128(value._hi32, value._lo64); 1522else if (typeof(TOther) == typeof(UInt128)) 1524UInt128 actualValue = (UInt128)(object)value; 1598else if (typeof(TOther) == typeof(UInt128)) 1600UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (6)
1368else if (typeof(TOther) == typeof(UInt128)) 1370UInt128 actualResult = checked((UInt128)value); 1466else if (typeof(TOther) == typeof(UInt128)) 1468UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Half.cs (15)
947/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="UInt128"/>.</summary> 951public static explicit operator UInt128(Half value) => (UInt128)(double)(value); 953/// <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> 956/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 958public static explicit operator checked UInt128(Half value) => checked((UInt128)(double)(value)); 2047else if (typeof(TOther) == typeof(UInt128)) 2049UInt128 actualResult = checked((UInt128)value); 2145else if (typeof(TOther) == typeof(UInt128)) 2147UInt128 actualResult = (value == PositiveInfinity) ? UInt128.MaxValue : 2148(value <= Zero) ? UInt128.MinValue : (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (38)
223return -(decimal)(UInt128)(value); 225return (decimal)(UInt128)(value); 236return -(double)(UInt128)(value); 238return (double)(UInt128)(value); 249return -(Half)(UInt128)(value); 251return (Half)(UInt128)(value); 359return -(float)(UInt128)(value); 361return (float)(UInt128)(value); 424/// <summary>Explicitly converts a 128-bit signed integer to a <see cref="UInt128" /> value.</summary> 426/// <returns><paramref name="value" /> converted to a <see cref="UInt128" />.</returns> 428public static explicit operator UInt128(Int128 value) => new UInt128(value._upper, value._lower); 430/// <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> 432/// <returns><paramref name="value" /> converted to a <see cref="UInt128" />.</returns> 435public static explicit operator checked UInt128(Int128 value) 736return (Int128)UInt128.Log10((UInt128)value); 1076UInt128 result = (UInt128)(left) / (UInt128)(right); 1148return (Int128)((UInt128)(left) * (UInt128)(right)); 1186UInt128 upper = UInt128.BigMul((UInt128)(left), (UInt128)(right), out UInt128 ulower); 1755else if (typeof(TOther) == typeof(UInt128)) 1757UInt128 actualResult = checked((UInt128)value); 1829else if (typeof(TOther) == typeof(UInt128)) 1831UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1899else if (typeof(TOther) == typeof(UInt128)) 1901UInt128 actualResult = (UInt128)value; 2136static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsGreaterThanAsUnsigned(Int128 left, Int128 right) => (UInt128)(left) > (UInt128)(right);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (10)
1141else if (typeof(TOther) == typeof(UInt128)) 1143UInt128 actualResult = checked((UInt128)value); 1210else if (typeof(TOther) == typeof(UInt128)) 1212UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1278else if (typeof(TOther) == typeof(UInt128)) 1280UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (10)
1206else if (typeof(TOther) == typeof(UInt128)) 1208UInt128 actualResult = checked((UInt128)value); 1277else if (typeof(TOther) == typeof(UInt128)) 1279UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1345else if (typeof(TOther) == typeof(UInt128)) 1347UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
1201else if (typeof(TOther) == typeof(UInt128)) 1203UInt128 actualResult = checked((UInt128)value); 1273else if (typeof(TOther) == typeof(UInt128)) 1275UInt128 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\IntPtr.cs (10)
1215else if (typeof(TOther) == typeof(UInt128)) 1217UInt128 actualResult = checked((UInt128)value); 1287else if (typeof(TOther) == typeof(UInt128)) 1289UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1355else if (typeof(TOther) == typeof(UInt128)) 1357UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
285public static UInt128 BigMul(ulong a, ulong b)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (38)
1368? UInt128ToDecStr((UInt128)value, digits: -1) 1384? UInt128ToDecStr((UInt128)value, digits) 1431? TryUInt128ToDecStr((UInt128)value, digits: -1, destination, out charsWritten) 1445? TryUInt128ToDecStr((UInt128)value, digits, destination, out charsWritten) 1484public static string FormatUInt128(UInt128 value, string? format, IFormatProvider? provider) 1494static unsafe string FormatUInt128Slow(UInt128 value, string? format, IFormatProvider? provider) 1541public static bool TryFormatUInt128<TChar>(UInt128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 1553static unsafe bool TryFormatUInt128Slow(UInt128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) 2471byte* p = UInt128ToDecChars(buffer + Int128Precision, (UInt128)value, 0); 2491? UInt128ToDecStr((UInt128)value, -1) 2504UInt128 absValue = (UInt128)(-value); 2532UInt128 absValue = (UInt128)(-value); 2563UInt128 uValue = (UInt128)value; 2584UInt128 uValue = (UInt128)value; 2603private static unsafe TChar* Int128ToHexChars<TChar>(TChar* buffer, UInt128 value, int hexBase, int digits) where TChar : unmanaged, IUtfChar<TChar> 2626UInt128 uValue = (UInt128)value; 2628int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value)); 2647UInt128 uValue = (UInt128)value; 2649int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value)); 2666private static unsafe TChar* UInt128ToBinaryChars<TChar>(TChar* buffer, UInt128 value, int digits) where TChar : unmanaged, IUtfChar<TChar> 2682private static unsafe void UInt128ToNumber(UInt128 value, ref NumberBuffer number) 2706private static ulong Int128DivMod1E19(ref UInt128 value) 2708UInt128 divisor = new UInt128(0, 10_000_000_000_000_000_000); 2709(value, UInt128 remainder) = UInt128.DivRem(value, divisor); 2714internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd, UInt128 value) where TChar : unmanaged, IUtfChar<TChar> 2726internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd, UInt128 value, int digits) where TChar : unmanaged, IUtfChar<TChar> 2738internal static unsafe string UInt128ToDecStr(UInt128 value) 2757internal static unsafe string UInt128ToDecStr(UInt128 value, int digits) 2775private 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\Random.cs (1)
323typeof(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)
1121else if (typeof(TOther) == typeof(UInt128)) 1123UInt128 actualResult = checked((UInt128)value); 1189else if (typeof(TOther) == typeof(UInt128)) 1191UInt128 actualResult = (value <= 0) ? UInt128.MinValue : (UInt128)value; 1257else if (typeof(TOther) == typeof(UInt128)) 1259UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Single.cs (6)
1387else if (typeof(TOther) == typeof(UInt128)) 1389UInt128 actualResult = checked((UInt128)value); 1485else if (typeof(TOther) == typeof(UInt128)) 1487UInt128 actualResult = (UInt128)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5586(sizeof(TResult) == sizeof(UInt128) && *(UInt128*)&result == default))
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (357)
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) 171public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out UInt128 result) 184public static explicit operator byte(UInt128 value) => (byte)value._lower; 189/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 190public static explicit operator checked byte(UInt128 value) 202public static explicit operator char(UInt128 value) => (char)value._lower; 207/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 208public static explicit operator checked char(UInt128 value) 220public static explicit operator decimal(UInt128 value) 238public static explicit operator double(UInt128 value) 288public static explicit operator Half(UInt128 value) => (Half)(double)(value); 293public static explicit operator short(UInt128 value) => (short)value._lower; 298/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 299public static explicit operator checked short(UInt128 value) 311public static explicit operator int(UInt128 value) => (int)value._lower; 316/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 317public static explicit operator checked int(UInt128 value) 329public static explicit operator long(UInt128 value) => (long)value._lower; 334/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 335public static explicit operator checked long(UInt128 value) 348public static explicit operator Int128(UInt128 value) => new Int128(value._upper, value._lower); 353/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 355public static explicit operator checked Int128(UInt128 value) 367public static explicit operator nint(UInt128 value) => (nint)value._lower; 372/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 373public static explicit operator checked nint(UInt128 value) 386public static explicit operator sbyte(UInt128 value) => (sbyte)value._lower; 391/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 393public static explicit operator checked sbyte(UInt128 value) 405public static explicit operator float(UInt128 value) => (float)(double)(value); 411public static explicit operator ushort(UInt128 value) => (ushort)value._lower; 416/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 418public static explicit operator checked ushort(UInt128 value) 431public static explicit operator uint(UInt128 value) => (uint)value._lower; 436/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 438public static explicit operator checked uint(UInt128 value) 451public static explicit operator ulong(UInt128 value) => value._lower; 456/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 458public static explicit operator checked ulong(UInt128 value) 471public static explicit operator nuint(UInt128 value) => (nuint)value._lower; 476/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 478public static explicit operator checked nuint(UInt128 value) 494public static explicit operator UInt128(decimal value) 508public static explicit operator UInt128(double value) 527/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 528public static explicit operator checked UInt128(double value) 543internal static UInt128 ToUInt128(double value) 565UInt128 result = new UInt128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000); 579public static explicit operator UInt128(short value) 588/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 589public static explicit operator checked UInt128(short value) 601public static explicit operator UInt128(int value) 610/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 611public static explicit operator checked UInt128(int value) 623public static explicit operator UInt128(long value) 632/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 633public static explicit operator checked UInt128(long value) 645public static explicit operator UInt128(nint value) 654/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 655public static explicit operator checked UInt128(nint value) 668public static explicit operator UInt128(sbyte value) 677/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 679public static explicit operator checked UInt128(sbyte value) 691public static explicit operator UInt128(float value) => (UInt128)(double)(value); 696/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="UInt128" />.</exception> 697public static explicit operator checked UInt128(float value) => checked((UInt128)(double)(value)); 706public static implicit operator UInt128(byte value) => new UInt128(0, value); 711public static implicit operator UInt128(char value) => new UInt128(0, value); 717public static implicit operator UInt128(ushort value) => new UInt128(0, value); 723public static implicit operator UInt128(uint value) => new UInt128(0, value); 729public static implicit operator UInt128(ulong value) => new UInt128(0, value); 735public static implicit operator UInt128(nuint value) => new UInt128(0, value); 742public static UInt128 operator +(UInt128 left, UInt128 right) 755public static UInt128 operator checked +(UInt128 left, UInt128 right) 772static UInt128 IAdditiveIdentity<UInt128, UInt128>.AdditiveIdentity => default; 779public static (UInt128 Quotient, UInt128 Remainder) DivRem(UInt128 left, UInt128 right) 795static (ulong Quotient, UInt128 Remainder) DivideSlow(UInt128 left, UInt128 right) 842UInt128 valMiLo = new UInt128(valMi, valLo); 852UInt128 divisor = new UInt128(divHi, divLo); 853UInt128 chkMiLo = new UInt128(chkMi, chkLo); 866UInt128 rem = valMiLo - chkMiLo; 872static (UInt128 Quotient, ulong Remainder) Divide128BitsBy64Bits(UInt128 left, ulong divisor) 1011public static UInt128 LeadingZeroCount(UInt128 value) 1016private static int LeadingZeroCountAsInt32(UInt128 value) 1026public static UInt128 Log10(UInt128 value) 1042private static readonly UInt128[] PowersOf10 = 1086public static UInt128 PopCount(UInt128 value) 1090public static UInt128 RotateLeft(UInt128 value, int rotateAmount) 1094public static UInt128 RotateRight(UInt128 value, int rotateAmount) 1098public static UInt128 TrailingZeroCount(UInt128 value) 1108static bool IBinaryInteger<UInt128>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out UInt128 value) 1110UInt128 result = default; 1156static bool IBinaryInteger<UInt128>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out UInt128 value) 1158UInt128 result = default; 1195UInt128 part = source[i]; 1207int IBinaryInteger<UInt128>.GetShortestBitLength() 1213int IBinaryInteger<UInt128>.GetByteCount() => Size; 1216bool IBinaryInteger<UInt128>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten) 1229bool IBinaryInteger<UInt128>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten) 1246static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1249public static bool IsPow2(UInt128 value) => PopCount(value) == 1U; 1252public static UInt128 Log2(UInt128 value) 1266public static UInt128 operator &(UInt128 left, UInt128 right) => new UInt128(left._upper & right._upper, left._lower & right._lower); 1269public static UInt128 operator |(UInt128 left, UInt128 right) => new UInt128(left._upper | right._upper, left._lower | right._lower); 1272public static UInt128 operator ^(UInt128 left, UInt128 right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower); 1275public static UInt128 operator ~(UInt128 value) => new UInt128(~value._upper, ~value._lower); 1282public static bool operator <(UInt128 left, UInt128 right) 1289public static bool operator <=(UInt128 left, UInt128 right) 1296public static bool operator >(UInt128 left, UInt128 right) 1303public static bool operator >=(UInt128 left, UInt128 right) 1314public static UInt128 operator --(UInt128 value) => value - One; 1317public static UInt128 operator checked --(UInt128 value) => checked(value - One); 1324public static UInt128 operator /(UInt128 left, UInt128 right) 1328public static UInt128 operator checked /(UInt128 left, UInt128 right) => left / right; 1335public static bool operator ==(UInt128 left, UInt128 right) => (left._lower == right._lower) && (left._upper == right._upper); 1338public static bool operator !=(UInt128 left, UInt128 right) => (left._lower != right._lower) || (left._upper != right._upper); 1345public static UInt128 operator ++(UInt128 value) => value + One; 1348public static UInt128 operator checked ++(UInt128 value) => checked(value + One); 1355public static UInt128 MinValue => new UInt128(0, 0); 1358public static UInt128 MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1365public static UInt128 operator %(UInt128 left, UInt128 right) 1373static UInt128 IMultiplicativeIdentity<UInt128, UInt128>.MultiplicativeIdentity => One; 1380public static UInt128 operator *(UInt128 left, UInt128 right) 1388public static UInt128 operator checked *(UInt128 left, UInt128 right) 1390UInt128 upper = BigMul(left, right, out UInt128 lower); 1405public static UInt128 BigMul(UInt128 left, UInt128 right, out UInt128 lower) 1419UInt128 mull = Math.BigMul(al, bl); 1420UInt128 t = Math.BigMul(ah, bl) + mull._upper; 1421UInt128 tl = Math.BigMul(al, bh) + t._lower; 1432public static UInt128 Clamp(UInt128 value, UInt128 min, UInt128 max) 1452static UInt128 INumber<UInt128>.CopySign(UInt128 value, UInt128 sign) => value; 1455public static UInt128 Max(UInt128 x, UInt128 y) => (x >= y) ? x : y; 1458static UInt128 INumber<UInt128>.MaxNumber(UInt128 x, UInt128 y) => Max(x, y); 1461public static UInt128 Min(UInt128 x, UInt128 y) => (x <= y) ? x : y; 1464static UInt128 INumber<UInt128>.MinNumber(UInt128 x, UInt128 y) => Min(x, y); 1467public static int Sign(UInt128 value) => (value == 0U) ? 0 : 1; 1474public static UInt128 One => new UInt128(0, 1); 1477static int INumberBase<UInt128>.Radix => 2; 1480public static UInt128 Zero => default; 1483static UInt128 INumberBase<UInt128>.Abs(UInt128 value) => value; 1487public static UInt128 CreateChecked<TOther>(TOther value) 1490UInt128 result; 1492if (typeof(TOther) == typeof(UInt128)) 1494result = (UInt128)(object)value; 1506public static UInt128 CreateSaturating<TOther>(TOther value) 1509UInt128 result; 1511if (typeof(TOther) == typeof(UInt128)) 1513result = (UInt128)(object)value; 1525public static UInt128 CreateTruncating<TOther>(TOther value) 1528UInt128 result; 1530if (typeof(TOther) == typeof(UInt128)) 1532result = (UInt128)(object)value; 1543static bool INumberBase<UInt128>.IsCanonical(UInt128 value) => true; 1546static bool INumberBase<UInt128>.IsComplexNumber(UInt128 value) => false; 1549public static bool IsEvenInteger(UInt128 value) => (value._lower & 1) == 0; 1552static bool INumberBase<UInt128>.IsFinite(UInt128 value) => true; 1555static bool INumberBase<UInt128>.IsImaginaryNumber(UInt128 value) => false; 1558static bool INumberBase<UInt128>.IsInfinity(UInt128 value) => false; 1561static bool INumberBase<UInt128>.IsInteger(UInt128 value) => true; 1564static bool INumberBase<UInt128>.IsNaN(UInt128 value) => false; 1567static bool INumberBase<UInt128>.IsNegative(UInt128 value) => false; 1570static bool INumberBase<UInt128>.IsNegativeInfinity(UInt128 value) => false; 1573static bool INumberBase<UInt128>.IsNormal(UInt128 value) => value != 0U; 1576public static bool IsOddInteger(UInt128 value) => (value._lower & 1) != 0; 1579static bool INumberBase<UInt128>.IsPositive(UInt128 value) => true; 1582static bool INumberBase<UInt128>.IsPositiveInfinity(UInt128 value) => false; 1585static bool INumberBase<UInt128>.IsRealNumber(UInt128 value) => true; 1588static bool INumberBase<UInt128>.IsSubnormal(UInt128 value) => false; 1591static bool INumberBase<UInt128>.IsZero(UInt128 value) => (value == 0U); 1594static UInt128 INumberBase<UInt128>.MaxMagnitude(UInt128 x, UInt128 y) => Max(x, y); 1597static UInt128 INumberBase<UInt128>.MaxMagnitudeNumber(UInt128 x, UInt128 y) => Max(x, y); 1600static UInt128 INumberBase<UInt128>.MinMagnitude(UInt128 x, UInt128 y) => Min(x, y); 1603static UInt128 INumberBase<UInt128>.MinMagnitudeNumber(UInt128 x, UInt128 y) => Min(x, y); 1606static UInt128 INumberBase<UInt128>.MultiplyAddEstimate(UInt128 left, UInt128 right, UInt128 addend) => (left * right) + addend; 1610static bool INumberBase<UInt128>.TryConvertFromChecked<TOther>(TOther value, out UInt128 result) => TryConvertFromChecked(value, out result); 1613private static bool TryConvertFromChecked<TOther>(TOther value, out UInt128 result) 1640result = checked((UInt128)actualValue); 1676static bool INumberBase<UInt128>.TryConvertFromSaturating<TOther>(TOther value, out UInt128 result) => TryConvertFromSaturating(value, out result); 1679private static bool TryConvertFromSaturating<TOther>(TOther value, out UInt128 result) 1706result = (actualValue < 0) ? MinValue : (UInt128)actualValue; 1742static bool INumberBase<UInt128>.TryConvertFromTruncating<TOther>(TOther value, out UInt128 result) => TryConvertFromTruncating(value, out result); 1745private static bool TryConvertFromTruncating<TOther>(TOther value, out UInt128 result) 1772result = (actualValue < 0) ? MinValue : (UInt128)actualValue; 1808static bool INumberBase<UInt128>.TryConvertToChecked<TOther>(UInt128 value, [MaybeNullWhen(false)] out TOther result) 1882static bool INumberBase<UInt128>.TryConvertToSaturating<TOther>(UInt128 value, [MaybeNullWhen(false)] out TOther result) 1962static bool INumberBase<UInt128>.TryConvertToTruncating<TOther>(UInt128 value, [MaybeNullWhen(false)] out TOther result) 2039public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out UInt128 result) => TryParse(s, NumberStyles.Integer, provider, out result); 2046public static UInt128 operator <<(UInt128 value, int shiftAmount) 2079public static UInt128 operator >>(UInt128 value, int shiftAmount) => value >>> shiftAmount; 2082public static UInt128 operator >>>(UInt128 value, int shiftAmount) 2119public static UInt128 Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); 2122public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out UInt128 result) => TryParse(s, NumberStyles.Integer, provider, out result); 2129public static UInt128 operator -(UInt128 left, UInt128 right) 2142public static UInt128 operator checked -(UInt128 left, UInt128 right) 2159public static UInt128 operator -(UInt128 value) => Zero - value; 2162public static UInt128 operator checked -(UInt128 value) => checked(Zero - value); 2169public static UInt128 operator +(UInt128 value) => value; 2176public static UInt128 Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 2179return Number.ParseBinaryInteger<byte, UInt128>(utf8Text, style, NumberFormatInfo.GetInstance(provider)); 2183public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out UInt128 result) 2190public static UInt128 Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider); 2193public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out UInt128 result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result); 2199static bool IBinaryIntegerParseAndFormatInfo<UInt128>.IsSigned => false; 2201static int IBinaryIntegerParseAndFormatInfo<UInt128>.MaxDigitCount => 39; // 340_282_366_920_938_463_463_374_607_431_768_211_455 2203static int IBinaryIntegerParseAndFormatInfo<UInt128>.MaxHexDigitCount => 32; // 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF 2205static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999); 2207static string IBinaryIntegerParseAndFormatInfo<UInt128>.OverflowMessage => SR.Overflow_UInt128; 2209static bool IBinaryIntegerParseAndFormatInfo<UInt128>.IsGreaterThanAsUnsigned(UInt128 left, UInt128 right) => left > right; 2211static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MultiplyBy10(UInt128 value) => value * 10; 2213static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MultiplyBy16(UInt128 value) => value * 16;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt16.cs (9)
737else if (typeof(TOther) == typeof(UInt128)) 739UInt128 actualValue = (UInt128)(object)value; 804else if (typeof(TOther) == typeof(UInt128)) 806UInt128 actualValue = (UInt128)(object)value; 871else if (typeof(TOther) == typeof(UInt128)) 873UInt128 actualValue = (UInt128)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
802else if (typeof(TOther) == typeof(UInt128)) 804UInt128 actualValue = (UInt128)(object)value; 869else if (typeof(TOther) == typeof(UInt128)) 871UInt128 actualValue = (UInt128)(object)value; 936else if (typeof(TOther) == typeof(UInt128)) 938UInt128 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); 809else if (typeof(TOther) == typeof(UInt128)) 811UInt128 actualValue = (UInt128)(object)value; 876else if (typeof(TOther) == typeof(UInt128)) 878UInt128 actualValue = (UInt128)(object)value; 943else if (typeof(TOther) == typeof(UInt128)) 945UInt128 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)
882[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.UInt128))]
System.Runtime.Numerics (109)
System\Number.BigInteger.cs (4)
552UInt128 p = (UInt128)bits[i] * multiplier + carry; 1497UInt128 p = (UInt128)multiplier * bits2[i] + carry;
System\Numerics\BigInteger.cs (37)
2159UInt128 uu; 2163uu = len > 1 ? new UInt128(value._bits[1], value._bits[0]) : (UInt128)(ulong)value._bits[0]; 2175? (UInt128)((ulong)(uint)value._bits[1] << 32 | (uint)value._bits[0]) 2176: (UInt128)(uint)value._bits[0]; 2243/// <summary>Explicitly converts a big integer to a <see cref="UInt128" /> value.</summary> 2245/// <returns><paramref name="value" /> converted to <see cref="UInt128" /> value.</returns> 2247public static explicit operator UInt128(BigInteger value) 2251return checked((UInt128)value._sign); 2266: (UInt128)(ulong)value._bits[0]; 2359UInt128 x; 2362x = (UInt128)(-value); 2367x = (UInt128)value; 2424/// <summary>Implicitly converts a <see cref="UInt128" /> value to a big integer.</summary> 2428public static implicit operator BigInteger(UInt128 value) 4179else if (typeof(TOther) == typeof(UInt128)) 4181UInt128 actualValue = (UInt128)(object)value; 4302else if (typeof(TOther) == typeof(UInt128)) 4304UInt128 actualValue = (UInt128)(object)value; 4425else if (typeof(TOther) == typeof(UInt128)) 4427UInt128 actualValue = (UInt128)(object)value; 4550else if (typeof(TOther) == typeof(UInt128)) 4552UInt128 actualResult = checked((UInt128)value); 4747else if (typeof(TOther) == typeof(UInt128)) 4749UInt128 actualResult = (value >= UInt128.MaxValue) ? UInt128.MaxValue : 4750IsNegative(value) ? UInt128.MinValue : (UInt128)value; 4955UInt128 bits = new(upperBits, lowerBits); 5109else if (typeof(TOther) == typeof(UInt128)) 5111UInt128 actualResult; 5149UInt128 bits = new(upperBits, lowerBits); 5160actualResult = (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 (18)
796/// <summary>Explicitly converts a <see cref="UInt128" /> value to a double-precision complex number.</summary> 800public static explicit operator Complex(UInt128 value) 1615else if (typeof(TOther) == typeof(UInt128)) 1617UInt128 actualValue = (UInt128)(object)value; 1810else if (typeof(TOther) == typeof(UInt128)) 1817UInt128 actualResult = checked((UInt128)value.m_real); 1968else if (typeof(TOther) == typeof(UInt128)) 1970UInt128 actualResult = (value.m_real >= 340282366920938463463374607431768211455.0) ? UInt128.MaxValue : 1971(value.m_real <= 0.0) ? UInt128.MinValue : (UInt128)value.m_real; 2110else if (typeof(TOther) == typeof(UInt128)) 2112UInt128 actualResult = (value.m_real >= 340282366920938463463374607431768211455.0) ? UInt128.MaxValue : 2113(value.m_real <= 0.0) ? UInt128.MinValue : (UInt128)value.m_real;
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)
731potentialNumberType == typeof(UInt128) ||