118 instantiations of UInt128
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHash128.cs (2)
127
return new
UInt128
(hash.High64, hash.Low64);
212
return new
UInt128
(current.High64, current.Low64);
Microsoft.CodeAnalysis (2)
Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
System.IO.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
125
return new
UInt128
(hash.High64, hash.Low64);
210
return 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)
189
return new
UInt128
(
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.Int128.cs (1)
35
value /= new
UInt128
(0x5, 0x6BC7_5E2D_6310_0000); // value /= 1e20
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (2)
1368
var significand = new
UInt128
(value._hi32, value._lo64);
1601
result = (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)
428
public static explicit operator UInt128(Int128 value) => new
UInt128
(value._upper, value._lower);
441
return new
UInt128
(value._upper, value._lower);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
288
return new
UInt128
(high, low);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (1)
2708
UInt128 divisor = new
UInt128
(0, 10_000_000_000_000_000_000);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (92)
502
return new
UInt128
(value.High, value.Low64);
565
UInt128 result = new
UInt128
((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000);
582
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
595
return new
UInt128
(0, (ushort)value);
604
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
617
return new
UInt128
(0, (uint)value);
626
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
639
return new
UInt128
(0, (ulong)value);
648
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
661
return new
UInt128
(0, (nuint)value);
671
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
685
return new
UInt128
(0, (byte)value);
706
public static implicit operator UInt128(byte value) => new
UInt128
(0, value);
711
public static implicit operator UInt128(char value) => new
UInt128
(0, value);
717
public static implicit operator UInt128(ushort value) => new
UInt128
(0, value);
723
public static implicit operator UInt128(uint value) => new
UInt128
(0, value);
729
public static implicit operator UInt128(ulong value) => new
UInt128
(0, value);
735
public static implicit operator UInt128(nuint value) => new
UInt128
(0, value);
751
return new
UInt128
(upper, lower);
764
return new
UInt128
(upper, lower);
842
UInt128 valMiLo = new
UInt128
(valMi, valLo);
852
UInt128 divisor = new
UInt128
(divHi, divLo);
853
UInt128 chkMiLo = new
UInt128
(chkMi, chkLo);
900
return (new
UInt128
(highRes, lowRes), remainder);
915
return (new
UInt128
(highRes, lowRes), remainder >> shift);
948
Debug.Assert(Math.BigMul(quo, divisor) + rem == (new
UInt128
(hi, lo)));
991
Debug.Assert(new
UInt128
(valHi, valMiLo) < new
UInt128
(chkHi, chkLo));
1004
Debug.Assert(new
UInt128
(valHi, valMiLo) == new
UInt128
(chkHi, chkLo) + remainder);
1044
new
UInt128
(0, 1UL),
1045
new
UInt128
(0, 10UL),
1046
new
UInt128
(0, 100UL),
1047
new
UInt128
(0, 1_000UL),
1048
new
UInt128
(0, 10_000UL),
1049
new
UInt128
(0, 100_000UL),
1050
new
UInt128
(0, 1_000_000UL),
1051
new
UInt128
(0, 10_000_000UL),
1052
new
UInt128
(0, 100_000_000UL),
1053
new
UInt128
(0, 1_000_000_000UL),
1054
new
UInt128
(0, 10_000_000_000UL),
1055
new
UInt128
(0, 100_000_000_000UL),
1056
new
UInt128
(0, 1_000_000_000_000UL),
1057
new
UInt128
(0, 10_000_000_000_000UL),
1058
new
UInt128
(0, 100_000_000_000_000UL),
1059
new
UInt128
(0, 1_000_000_000_000_000UL),
1060
new
UInt128
(0, 10_000_000_000_000_000UL),
1061
new
UInt128
(0, 100_000_000_000_000_000UL),
1062
new
UInt128
(0, 1_000_000_000_000_000_000UL),
1063
new
UInt128
(0, 10_000_000_000_000_000_000UL),
1064
new
UInt128
(5, 7766279631452241920UL),
1065
new
UInt128
(54, 3875820019684212736UL),
1066
new
UInt128
(542, 1864712049423024128UL),
1067
new
UInt128
(5421, 200376420520689664UL),
1068
new
UInt128
(54210, 2003764205206896640UL),
1069
new
UInt128
(542101, 1590897978359414784UL),
1070
new
UInt128
(5421010, 15908979783594147840UL),
1071
new
UInt128
(54210108, 11515845246265065472UL),
1072
new
UInt128
(542101086, 4477988020393345024UL),
1073
new
UInt128
(5421010862, 7886392056514347008UL),
1074
new
UInt128
(54210108624, 5076944270305263616UL),
1075
new
UInt128
(542101086242, 13875954555633532928UL),
1076
new
UInt128
(5421010862427, 9632337040368467968UL),
1077
new
UInt128
(54210108624275, 4089650035136921600UL),
1078
new
UInt128
(542101086242752, 4003012203950112768UL),
1079
new
UInt128
(5421010862427522, 3136633892082024448UL),
1080
new
UInt128
(54210108624275221, 12919594847110692864UL),
1081
new
UInt128
(542101086242752217, 68739955140067328UL),
1082
new
UInt128
(5421010862427522170, 687399551400673280UL),
1246
static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new
UInt128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1266
public static UInt128 operator &(UInt128 left, UInt128 right) => new
UInt128
(left._upper & right._upper, left._lower & right._lower);
1269
public static UInt128 operator |(UInt128 left, UInt128 right) => new
UInt128
(left._upper | right._upper, left._lower | right._lower);
1272
public static UInt128 operator ^(UInt128 left, UInt128 right) => new
UInt128
(left._upper ^ right._upper, left._lower ^ right._lower);
1275
public static UInt128 operator ~(UInt128 value) => new
UInt128
(~value._upper, ~value._lower);
1355
public static UInt128 MinValue => new
UInt128
(0, 0);
1358
public static UInt128 MaxValue => new
UInt128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1384
return new
UInt128
(upper, lower);
1423
lower = new
UInt128
(tl._lower, mull._lower);
1474
public static UInt128 One => new
UInt128
(0, 1);
1907
short actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_0000_7FFF)) ? short.MaxValue : (short)value;
1913
int actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_7FFF_FFFF)) ? int.MaxValue : (int)value;
1919
long actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? long.MaxValue : (long)value;
1925
Int128 actualResult = (value >= new
UInt128
(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? Int128.MaxValue : (Int128)value;
1936
nint actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? nint.MaxValue : (nint)value;
1943
sbyte actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_0000_007F)) ? sbyte.MaxValue : (sbyte)value;
2060
return new
UInt128
(upper, 0);
2070
return new
UInt128
(upper, lower);
2096
return new
UInt128
(0, lower);
2106
return new
UInt128
(upper, lower);
2138
return new
UInt128
(upper, lower);
2151
return new
UInt128
(upper, lower);
2205
static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new
UInt128
(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
System.Runtime.Numerics (8)
System\Numerics\BigInteger.cs (8)
2163
uu = len > 1 ? new
UInt128
(value._bits[1], value._bits[0]) : (UInt128)(ulong)value._bits[0];
2167
uu = new
UInt128
(
2265
? new
UInt128
(value._bits[1], value._bits[0])
2270
return new
UInt128
(
2388
else if (x <= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF))
2459
else if (value <= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF))
4955
UInt128 bits =
new
(upperBits, lowerBits);
5149
UInt128 bits =
new
(upperBits, lowerBits);
862 references to UInt128
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.AspNetCore.Components.Endpoints (7)
FormMapping\Converters\NullableConverter.cs (1)
72
type == typeof(
UInt128
) ||
FormMapping\WellKnownConverters.cs (6)
35
{ typeof(
UInt128
), new ParsableConverter<
UInt128
>() },
67
converters.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)
72
type == typeof(
UInt128
) ||
src\aspnetcore\src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
35
{ typeof(
UInt128
), new ParsableConverter<
UInt128
>() },
67
converters.Add(typeof(
UInt128
?), new NullableConverter<
UInt128
>((FormDataConverter<
UInt128
>)converters[typeof(
UInt128
)]));
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiConstants.cs (1)
35
typeof(
UInt128
),
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHash128.cs (2)
124
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
209
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.CodeAnalysis (2)
Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
64
yield return new TestData<
UInt128
>(42, """{"type":"integer"}""");
1224
[JsonSerializable(typeof(
UInt128
))]
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
64
yield return new TestData<
UInt128
>(42, """{"type":"integer"}""");
1224
[JsonSerializable(typeof(
UInt128
))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
71
typeof(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)
18
internal override Type TargetType => typeof(
UInt128
);
28
return
UInt128
.Parse(value, NumberStyles.HexNumber);
35
UInt128
.Parse(value, formatInfo);
41
((
UInt128
)value).ToString(formatInfo);
System.IO.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
122
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
207
public
UInt128
GetCurrentHashAsUInt128()
System.Linq (11)
System\Linq\Max.cs (4)
335
if (typeof(TSource) == typeof(
UInt128
) && comparer == Comparer<TSource>.Default) return (TSource)(object)MinMaxInteger<
UInt128
, MaxCalc<
UInt128
>>((IEnumerable<
UInt128
>)source);
System\Linq\Min.cs (4)
314
if (typeof(TSource) == typeof(
UInt128
) && comparer == Comparer<TSource>.Default) return (TSource)(object)MinMaxInteger<
UInt128
, MinCalc<
UInt128
>>((IEnumerable<
UInt128
>)source);
System\Linq\OrderBy.cs (1)
161
t == typeof(Int128) || t == typeof(
UInt128
) ||
System\Linq\Sequence.cs (2)
91
if (typeof(T) == typeof(ulong) && (range = TryUseRange<
UInt128
>(start, endInclusive, step, ulong.MaxValue)) is not null) return range;
93
if (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)
93
UInt128
baseAddressValue = default;
94
UInt128
otherAddressValue = default;
96
BaseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref baseAddressValue)), out int bytesWritten);
98
address.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref otherAddressValue)), out bytesWritten);
101
UInt128
mask =
UInt128
.MaxValue << (128 - PrefixLength);
262
UInt128
value = default;
263
baseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref value)), out int bytesWritten);
266
UInt128
mask =
UInt128
.MaxValue << (128 - prefixLength);
272
UInt128
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)
64
typeof(T) != typeof(
UInt128
);
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
77
typeof(T) == typeof(Int128) || typeof(T) == typeof(
UInt128
) ||
System.Private.CoreLib (675)
src\runtime\src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (10)
287
public static byte[] GetBytes(
UInt128
value)
289
byte[] bytes = new byte[
UInt128
.Size];
302
public static bool TryWriteBytes(Span<byte> destination,
UInt128
value)
304
if (destination.Length <
UInt128
.Size)
697
public static
UInt128
ToUInt128(byte[] value, int startIndex)
703
if (startIndex > value.Length -
UInt128
.Size)
706
return Unsafe.ReadUnaligned<
UInt128
>(ref value[startIndex]);
717
public static
UInt128
ToUInt128(ReadOnlySpan<byte> value)
719
if (value.Length <
UInt128
.Size)
721
return 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
" />.
230
public static
UInt128
ReadUInt128BigEndian(ReadOnlySpan<byte> source)
233
ReverseEndianness(MemoryMarshal.Read<
UInt128
>(source)) :
234
MemoryMarshal.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" />.
532
public static bool TryReadUInt128BigEndian(ReadOnlySpan<byte> source, out
UInt128
value)
536
bool 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
" />.
230
public static
UInt128
ReadUInt128LittleEndian(ReadOnlySpan<byte> source)
233
ReverseEndianness(MemoryMarshal.Read<
UInt128
>(source)) :
234
MemoryMarshal.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" />.
532
public static bool TryReadUInt128LittleEndian(ReadOnlySpan<byte> source, out
UInt128
value)
539
bool 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.
187
public static
UInt128
ReverseEndianness(
UInt128
value)
375
public static void ReverseEndianness(ReadOnlySpan<
UInt128
> source, Span<
UInt128
> destination) =>
376
ReverseEndianness(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
" />.
302
public static void WriteUInt128BigEndian(Span<byte> destination,
UInt128
value)
306
UInt128
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" />.
605
public static bool TryWriteUInt128BigEndian(Span<byte> destination,
UInt128
value)
609
UInt128
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
" />.
302
public static void WriteUInt128LittleEndian(Span<byte> destination,
UInt128
value)
306
UInt128
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" />.
605
public static bool TryWriteUInt128LittleEndian(Span<byte> destination,
UInt128
value)
609
UInt128
tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.Int128.cs (3)
12
public static int CountDigits(
UInt128
value)
53
public static int CountHexDigits(
UInt128
value)
56
return ((int)
UInt128
.Log2(value) >> 2) + 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Byte.cs (9)
732
else if (typeof(TOther) == typeof(
UInt128
))
734
UInt128
actualValue = (
UInt128
)(object)value;
799
else if (typeof(TOther) == typeof(
UInt128
))
801
UInt128
actualValue = (
UInt128
)(object)value;
866
else if (typeof(TOther) == typeof(
UInt128
))
868
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (9)
1591
else if (typeof(TOther) == typeof(
UInt128
))
1593
UInt128
actualValue = (
UInt128
)(object)value;
1654
else if (typeof(TOther) == typeof(
UInt128
))
1656
UInt128
actualValue = (
UInt128
)(object)value;
1717
else if (typeof(TOther) == typeof(
UInt128
))
1719
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (7)
1368
var
significand = new UInt128(value._hi32, value._lo64);
1522
else if (typeof(TOther) == typeof(
UInt128
))
1524
UInt128
actualValue = (
UInt128
)(object)value;
1598
else if (typeof(TOther) == typeof(
UInt128
))
1600
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (6)
1368
else if (typeof(TOther) == typeof(
UInt128
))
1370
UInt128
actualResult = checked((
UInt128
)value);
1466
else if (typeof(TOther) == typeof(
UInt128
))
1468
UInt128
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>
951
public 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>
958
public static explicit operator checked
UInt128
(Half value) => checked((
UInt128
)(double)(value));
2047
else if (typeof(TOther) == typeof(
UInt128
))
2049
UInt128
actualResult = checked((
UInt128
)value);
2145
else if (typeof(TOther) == typeof(
UInt128
))
2147
UInt128
actualResult = (value == PositiveInfinity) ?
UInt128
.MaxValue :
2148
(value <= Zero) ?
UInt128
.MinValue : (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (38)
223
return -(decimal)(
UInt128
)(value);
225
return (decimal)(
UInt128
)(value);
236
return -(double)(
UInt128
)(value);
238
return (double)(
UInt128
)(value);
249
return -(Half)(
UInt128
)(value);
251
return (Half)(
UInt128
)(value);
359
return -(float)(
UInt128
)(value);
361
return (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>
428
public 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>
435
public static explicit operator checked
UInt128
(Int128 value)
736
return (Int128)
UInt128
.Log10((
UInt128
)value);
1076
UInt128
result = (
UInt128
)(left) / (
UInt128
)(right);
1148
return (Int128)((
UInt128
)(left) * (
UInt128
)(right));
1186
UInt128
upper =
UInt128
.BigMul((
UInt128
)(left), (
UInt128
)(right), out
UInt128
ulower);
1755
else if (typeof(TOther) == typeof(
UInt128
))
1757
UInt128
actualResult = checked((
UInt128
)value);
1829
else if (typeof(TOther) == typeof(
UInt128
))
1831
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1899
else if (typeof(TOther) == typeof(
UInt128
))
1901
UInt128
actualResult = (
UInt128
)value;
2136
static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsGreaterThanAsUnsigned(Int128 left, Int128 right) => (
UInt128
)(left) > (
UInt128
)(right);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (10)
1141
else if (typeof(TOther) == typeof(
UInt128
))
1143
UInt128
actualResult = checked((
UInt128
)value);
1210
else if (typeof(TOther) == typeof(
UInt128
))
1212
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1278
else if (typeof(TOther) == typeof(
UInt128
))
1280
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (10)
1206
else if (typeof(TOther) == typeof(
UInt128
))
1208
UInt128
actualResult = checked((
UInt128
)value);
1277
else if (typeof(TOther) == typeof(
UInt128
))
1279
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1345
else if (typeof(TOther) == typeof(
UInt128
))
1347
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
1201
else if (typeof(TOther) == typeof(
UInt128
))
1203
UInt128
actualResult = checked((
UInt128
)value);
1273
else if (typeof(TOther) == typeof(
UInt128
))
1275
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1348
else if (typeof(TOther) == typeof(
UInt128
))
1350
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (10)
1215
else if (typeof(TOther) == typeof(
UInt128
))
1217
UInt128
actualResult = checked((
UInt128
)value);
1287
else if (typeof(TOther) == typeof(
UInt128
))
1289
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1355
else if (typeof(TOther) == typeof(
UInt128
))
1357
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
285
public 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)
1484
public static string FormatUInt128(
UInt128
value, string? format, IFormatProvider? provider)
1494
static unsafe string FormatUInt128Slow(
UInt128
value, string? format, IFormatProvider? provider)
1541
public static bool TryFormatUInt128<TChar>(
UInt128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1553
static unsafe bool TryFormatUInt128Slow(
UInt128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
2471
byte* p = UInt128ToDecChars(buffer + Int128Precision, (
UInt128
)value, 0);
2491
? UInt128ToDecStr((
UInt128
)value, -1)
2504
UInt128
absValue = (
UInt128
)(-value);
2532
UInt128
absValue = (
UInt128
)(-value);
2563
UInt128
uValue = (
UInt128
)value;
2584
UInt128
uValue = (
UInt128
)value;
2603
private static unsafe TChar* Int128ToHexChars<TChar>(TChar* buffer,
UInt128
value, int hexBase, int digits) where TChar : unmanaged, IUtfChar<TChar>
2626
UInt128
uValue = (
UInt128
)value;
2628
int bufferLength = Math.Max(digits, 128 - (int)
UInt128
.LeadingZeroCount((
UInt128
)value));
2647
UInt128
uValue = (
UInt128
)value;
2649
int bufferLength = Math.Max(digits, 128 - (int)
UInt128
.LeadingZeroCount((
UInt128
)value));
2666
private static unsafe TChar* UInt128ToBinaryChars<TChar>(TChar* buffer,
UInt128
value, int digits) where TChar : unmanaged, IUtfChar<TChar>
2682
private static unsafe void UInt128ToNumber(
UInt128
value, ref NumberBuffer number)
2706
private static ulong Int128DivMod1E19(ref
UInt128
value)
2708
UInt128
divisor = new UInt128(0, 10_000_000_000_000_000_000);
2709
(value,
UInt128
remainder) =
UInt128
.DivRem(value, divisor);
2714
internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd,
UInt128
value) where TChar : unmanaged, IUtfChar<TChar>
2726
internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd,
UInt128
value, int digits) where TChar : unmanaged, IUtfChar<TChar>
2738
internal static unsafe string UInt128ToDecStr(
UInt128
value)
2757
internal static unsafe string UInt128ToDecStr(
UInt128
value, int digits)
2775
private 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>
646
public 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>
790
public 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>
797
public static explicit operator checked
UInt128
(BFloat16 value) => checked((
UInt128
)(double)(value));
1658
else if (typeof(TOther) == typeof(
UInt128
))
1660
UInt128
actualValue = (
UInt128
)(object)value;
1774
else if (typeof(TOther) == typeof(
UInt128
))
1776
UInt128
actualResult = checked((
UInt128
)value);
1923
else if (typeof(TOther) == typeof(
UInt128
))
1925
UInt128
actualResult = (value == PositiveInfinity) ?
UInt128
.MaxValue :
1926
(value <= Zero) ?
UInt128
.MinValue : (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
323
typeof(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>
425
public 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>
433
public static explicit operator checked
UInt128
(NFloat value) => checked((
UInt128
)(value._value));
499
return -(NFloat)(
UInt128
)(value);
501
return (NFloat)(
UInt128
)(value);
544
/// <summary>Explicitly converts <see cref="
UInt128
"/> to its nearest representable native-sized floating-point value.</summary>
549
public static explicit operator NFloat(
UInt128
value) => (NFloat)(double)(value);
1434
else if (typeof(TOther) == typeof(
UInt128
))
1436
UInt128
actualValue = (
UInt128
)(object)value;
1547
else if (typeof(TOther) == typeof(
UInt128
))
1549
UInt128
actualResult = checked((
UInt128
)value);
1688
else if (typeof(TOther) == typeof(
UInt128
))
1690
UInt128
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)
1121
else if (typeof(TOther) == typeof(
UInt128
))
1123
UInt128
actualResult = checked((
UInt128
)value);
1189
else if (typeof(TOther) == typeof(
UInt128
))
1191
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1257
else if (typeof(TOther) == typeof(
UInt128
))
1259
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Single.cs (6)
1387
else if (typeof(TOther) == typeof(
UInt128
))
1389
UInt128
actualResult = checked((
UInt128
)value);
1485
else if (typeof(TOther) == typeof(
UInt128
))
1487
UInt128
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
>,
21
IMinMaxValue<
UInt128
>,
22
IUnsignedNumber<
UInt128
>,
24
IBinaryIntegerParseAndFormatInfo<
UInt128
>
36
/// <summary>Initializes a new instance of the <see cref="
UInt128
" /> struct.</summary>
53
if (value is
UInt128
other)
68
public int CompareTo(
UInt128
value)
87
return (obj is
UInt128
other) && Equals(other);
91
public bool Equals(
UInt128
other)
131
public static
UInt128
Parse(string s) => Parse(s, NumberStyles.Integer, provider: null);
133
public static
UInt128
Parse(string s, NumberStyles style) => Parse(s, style, provider: null);
135
public static
UInt128
Parse(string s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
137
public static
UInt128
Parse(string s, NumberStyles style, IFormatProvider? provider)
143
public static
UInt128
Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
146
return Number.ParseBinaryInteger<char,
UInt128
>(s, style, NumberFormatInfo.GetInstance(provider));
149
public static bool TryParse([NotNullWhen(true)] string? s, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider: null, out result);
151
public static bool TryParse(ReadOnlySpan<char> s, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider: null, out result);
157
public static bool TryParse(ReadOnlySpan<byte> utf8Text, out
UInt128
result) => TryParse(utf8Text, NumberStyles.Integer, provider: null, out result);
159
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
171
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
184
public static explicit operator byte(
UInt128
value) => (byte)value._lower;
189
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
190
public static explicit operator checked byte(
UInt128
value)
202
public static explicit operator char(
UInt128
value) => (char)value._lower;
207
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
208
public static explicit operator checked char(
UInt128
value)
220
public static explicit operator decimal(
UInt128
value)
238
public static explicit operator double(
UInt128
value)
288
public static explicit operator Half(
UInt128
value) => (Half)(double)(value);
293
public static explicit operator short(
UInt128
value) => (short)value._lower;
298
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
299
public static explicit operator checked short(
UInt128
value)
311
public static explicit operator int(
UInt128
value) => (int)value._lower;
316
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
317
public static explicit operator checked int(
UInt128
value)
329
public static explicit operator long(
UInt128
value) => (long)value._lower;
334
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
335
public static explicit operator checked long(
UInt128
value)
348
public 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>
355
public static explicit operator checked Int128(
UInt128
value)
367
public static explicit operator nint(
UInt128
value) => (nint)value._lower;
372
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
373
public static explicit operator checked nint(
UInt128
value)
386
public static explicit operator sbyte(
UInt128
value) => (sbyte)value._lower;
391
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
393
public static explicit operator checked sbyte(
UInt128
value)
405
public static explicit operator float(
UInt128
value) => (float)(double)(value);
411
public static explicit operator ushort(
UInt128
value) => (ushort)value._lower;
416
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
418
public static explicit operator checked ushort(
UInt128
value)
431
public static explicit operator uint(
UInt128
value) => (uint)value._lower;
436
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
438
public static explicit operator checked uint(
UInt128
value)
451
public static explicit operator ulong(
UInt128
value) => value._lower;
456
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
458
public static explicit operator checked ulong(
UInt128
value)
471
public static explicit operator nuint(
UInt128
value) => (nuint)value._lower;
476
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
478
public static explicit operator checked nuint(
UInt128
value)
494
public static explicit operator
UInt128
(decimal value)
508
public static explicit operator
UInt128
(double value)
527
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
528
public static explicit operator checked
UInt128
(double value)
543
internal static
UInt128
ToUInt128(double value)
565
UInt128
result = new UInt128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000);
579
public static explicit operator
UInt128
(short value)
588
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
589
public static explicit operator checked
UInt128
(short value)
601
public static explicit operator
UInt128
(int value)
610
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
611
public static explicit operator checked
UInt128
(int value)
623
public static explicit operator
UInt128
(long value)
632
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
633
public static explicit operator checked
UInt128
(long value)
645
public static explicit operator
UInt128
(nint value)
654
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
655
public static explicit operator checked
UInt128
(nint value)
668
public static explicit operator
UInt128
(sbyte value)
677
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
679
public static explicit operator checked
UInt128
(sbyte value)
691
public static explicit operator
UInt128
(float value) => (
UInt128
)(double)(value);
696
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
697
public static explicit operator checked
UInt128
(float value) => checked((
UInt128
)(double)(value));
706
public static implicit operator
UInt128
(byte value) => new UInt128(0, value);
711
public static implicit operator
UInt128
(char value) => new UInt128(0, value);
717
public static implicit operator
UInt128
(ushort value) => new UInt128(0, value);
723
public static implicit operator
UInt128
(uint value) => new UInt128(0, value);
729
public static implicit operator
UInt128
(ulong value) => new UInt128(0, value);
735
public static implicit operator
UInt128
(nuint value) => new UInt128(0, value);
742
public static
UInt128
operator +(
UInt128
left,
UInt128
right)
755
public static
UInt128
operator checked +(
UInt128
left,
UInt128
right)
772
static
UInt128
IAdditiveIdentity<
UInt128
,
UInt128
>.AdditiveIdentity => default;
779
public static (
UInt128
Quotient,
UInt128
Remainder) DivRem(
UInt128
left,
UInt128
right)
795
static (ulong Quotient,
UInt128
Remainder) DivideSlow(
UInt128
left,
UInt128
right)
842
UInt128
valMiLo = new UInt128(valMi, valLo);
852
UInt128
divisor = new UInt128(divHi, divLo);
853
UInt128
chkMiLo = new UInt128(chkMi, chkLo);
866
UInt128
rem = valMiLo - chkMiLo;
872
static (
UInt128
Quotient, ulong Remainder) Divide128BitsBy64Bits(
UInt128
left, ulong divisor)
1011
public static
UInt128
LeadingZeroCount(
UInt128
value)
1016
private static int LeadingZeroCountAsInt32(
UInt128
value)
1026
public static
UInt128
Log10(
UInt128
value)
1042
private static readonly
UInt128
[] PowersOf10 =
1086
public static
UInt128
PopCount(
UInt128
value)
1090
public static
UInt128
RotateLeft(
UInt128
value, int rotateAmount)
1094
public static
UInt128
RotateRight(
UInt128
value, int rotateAmount)
1098
public static
UInt128
TrailingZeroCount(
UInt128
value)
1108
static bool IBinaryInteger<
UInt128
>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
UInt128
value)
1110
UInt128
result = default;
1156
static bool IBinaryInteger<
UInt128
>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
UInt128
value)
1158
UInt128
result = default;
1195
UInt128
part = source[i];
1207
int IBinaryInteger<
UInt128
>.GetShortestBitLength()
1213
int IBinaryInteger<
UInt128
>.GetByteCount() => Size;
1216
bool IBinaryInteger<
UInt128
>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
1229
bool IBinaryInteger<
UInt128
>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
1246
static
UInt128
IBinaryNumber<
UInt128
>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1249
public static bool IsPow2(
UInt128
value) => PopCount(value) == 1U;
1252
public static
UInt128
Log2(
UInt128
value)
1266
public static
UInt128
operator &(
UInt128
left,
UInt128
right) => new UInt128(left._upper & right._upper, left._lower & right._lower);
1269
public static
UInt128
operator |(
UInt128
left,
UInt128
right) => new UInt128(left._upper | right._upper, left._lower | right._lower);
1272
public static
UInt128
operator ^(
UInt128
left,
UInt128
right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower);
1275
public static
UInt128
operator ~(
UInt128
value) => new UInt128(~value._upper, ~value._lower);
1282
public static bool operator <(
UInt128
left,
UInt128
right)
1289
public static bool operator <=(
UInt128
left,
UInt128
right)
1296
public static bool operator >(
UInt128
left,
UInt128
right)
1303
public static bool operator >=(
UInt128
left,
UInt128
right)
1314
public static
UInt128
operator --(
UInt128
value) => value - One;
1317
public static
UInt128
operator checked --(
UInt128
value) => checked(value - One);
1324
public static
UInt128
operator /(
UInt128
left,
UInt128
right)
1328
public static
UInt128
operator checked /(
UInt128
left,
UInt128
right) => left / right;
1335
public static bool operator ==(
UInt128
left,
UInt128
right) => (left._lower == right._lower) && (left._upper == right._upper);
1338
public static bool operator !=(
UInt128
left,
UInt128
right) => (left._lower != right._lower) || (left._upper != right._upper);
1345
public static
UInt128
operator ++(
UInt128
value) => value + One;
1348
public static
UInt128
operator checked ++(
UInt128
value) => checked(value + One);
1355
public static
UInt128
MinValue => new UInt128(0, 0);
1358
public static
UInt128
MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1365
public static
UInt128
operator %(
UInt128
left,
UInt128
right)
1373
static
UInt128
IMultiplicativeIdentity<
UInt128
,
UInt128
>.MultiplicativeIdentity => One;
1380
public static
UInt128
operator *(
UInt128
left,
UInt128
right)
1388
public static
UInt128
operator checked *(
UInt128
left,
UInt128
right)
1390
UInt128
upper = BigMul(left, right, out
UInt128
lower);
1405
public static
UInt128
BigMul(
UInt128
left,
UInt128
right, out
UInt128
lower)
1419
UInt128
mull = Math.BigMul(al, bl);
1420
UInt128
t = Math.BigMul(ah, bl) + mull._upper;
1421
UInt128
tl = Math.BigMul(al, bh) + t._lower;
1432
public static
UInt128
Clamp(
UInt128
value,
UInt128
min,
UInt128
max)
1452
static
UInt128
INumber<
UInt128
>.CopySign(
UInt128
value,
UInt128
sign) => value;
1455
public static
UInt128
Max(
UInt128
x,
UInt128
y) => (x >= y) ? x : y;
1458
static
UInt128
INumber<
UInt128
>.MaxNumber(
UInt128
x,
UInt128
y) => Max(x, y);
1461
public static
UInt128
Min(
UInt128
x,
UInt128
y) => (x <= y) ? x : y;
1464
static
UInt128
INumber<
UInt128
>.MinNumber(
UInt128
x,
UInt128
y) => Min(x, y);
1467
public static int Sign(
UInt128
value) => (value == 0U) ? 0 : 1;
1474
public static
UInt128
One => new UInt128(0, 1);
1477
static int INumberBase<
UInt128
>.Radix => 2;
1480
public static
UInt128
Zero => default;
1483
static
UInt128
INumberBase<
UInt128
>.Abs(
UInt128
value) => value;
1487
public static
UInt128
CreateChecked<TOther>(TOther value)
1490
UInt128
result;
1492
if (typeof(TOther) == typeof(
UInt128
))
1494
result = (
UInt128
)(object)value;
1506
public static
UInt128
CreateSaturating<TOther>(TOther value)
1509
UInt128
result;
1511
if (typeof(TOther) == typeof(
UInt128
))
1513
result = (
UInt128
)(object)value;
1525
public static
UInt128
CreateTruncating<TOther>(TOther value)
1528
UInt128
result;
1530
if (typeof(TOther) == typeof(
UInt128
))
1532
result = (
UInt128
)(object)value;
1543
static bool INumberBase<
UInt128
>.IsCanonical(
UInt128
value) => true;
1546
static bool INumberBase<
UInt128
>.IsComplexNumber(
UInt128
value) => false;
1549
public static bool IsEvenInteger(
UInt128
value) => (value._lower & 1) == 0;
1552
static bool INumberBase<
UInt128
>.IsFinite(
UInt128
value) => true;
1555
static bool INumberBase<
UInt128
>.IsImaginaryNumber(
UInt128
value) => false;
1558
static bool INumberBase<
UInt128
>.IsInfinity(
UInt128
value) => false;
1561
static bool INumberBase<
UInt128
>.IsInteger(
UInt128
value) => true;
1564
static bool INumberBase<
UInt128
>.IsNaN(
UInt128
value) => false;
1567
static bool INumberBase<
UInt128
>.IsNegative(
UInt128
value) => false;
1570
static bool INumberBase<
UInt128
>.IsNegativeInfinity(
UInt128
value) => false;
1573
static bool INumberBase<
UInt128
>.IsNormal(
UInt128
value) => value != 0U;
1576
public static bool IsOddInteger(
UInt128
value) => (value._lower & 1) != 0;
1579
static bool INumberBase<
UInt128
>.IsPositive(
UInt128
value) => true;
1582
static bool INumberBase<
UInt128
>.IsPositiveInfinity(
UInt128
value) => false;
1585
static bool INumberBase<
UInt128
>.IsRealNumber(
UInt128
value) => true;
1588
static bool INumberBase<
UInt128
>.IsSubnormal(
UInt128
value) => false;
1591
static bool INumberBase<
UInt128
>.IsZero(
UInt128
value) => (value == 0U);
1594
static
UInt128
INumberBase<
UInt128
>.MaxMagnitude(
UInt128
x,
UInt128
y) => Max(x, y);
1597
static
UInt128
INumberBase<
UInt128
>.MaxMagnitudeNumber(
UInt128
x,
UInt128
y) => Max(x, y);
1600
static
UInt128
INumberBase<
UInt128
>.MinMagnitude(
UInt128
x,
UInt128
y) => Min(x, y);
1603
static
UInt128
INumberBase<
UInt128
>.MinMagnitudeNumber(
UInt128
x,
UInt128
y) => Min(x, y);
1606
static
UInt128
INumberBase<
UInt128
>.MultiplyAddEstimate(
UInt128
left,
UInt128
right,
UInt128
addend) => (left * right) + addend;
1610
static bool INumberBase<
UInt128
>.TryConvertFromChecked<TOther>(TOther value, out
UInt128
result) => TryConvertFromChecked(value, out result);
1613
private static bool TryConvertFromChecked<TOther>(TOther value, out
UInt128
result)
1640
result = checked((
UInt128
)actualValue);
1676
static bool INumberBase<
UInt128
>.TryConvertFromSaturating<TOther>(TOther value, out
UInt128
result) => TryConvertFromSaturating(value, out result);
1679
private static bool TryConvertFromSaturating<TOther>(TOther value, out
UInt128
result)
1706
result = (actualValue < 0) ? MinValue : (
UInt128
)actualValue;
1742
static bool INumberBase<
UInt128
>.TryConvertFromTruncating<TOther>(TOther value, out
UInt128
result) => TryConvertFromTruncating(value, out result);
1745
private static bool TryConvertFromTruncating<TOther>(TOther value, out
UInt128
result)
1772
result = (actualValue < 0) ? MinValue : (
UInt128
)actualValue;
1808
static bool INumberBase<
UInt128
>.TryConvertToChecked<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
1882
static bool INumberBase<
UInt128
>.TryConvertToSaturating<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
1962
static bool INumberBase<
UInt128
>.TryConvertToTruncating<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
2039
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2046
public static
UInt128
operator <<(
UInt128
value, int shiftAmount)
2079
public static
UInt128
operator >>(
UInt128
value, int shiftAmount) => value >>> shiftAmount;
2082
public static
UInt128
operator >>>(
UInt128
value, int shiftAmount)
2119
public static
UInt128
Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
2122
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2129
public static
UInt128
operator -(
UInt128
left,
UInt128
right)
2142
public static
UInt128
operator checked -(
UInt128
left,
UInt128
right)
2159
public static
UInt128
operator -(
UInt128
value) => Zero - value;
2162
public static
UInt128
operator checked -(
UInt128
value) => checked(Zero - value);
2169
public static
UInt128
operator +(
UInt128
value) => value;
2176
public static
UInt128
Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
2179
return Number.ParseBinaryInteger<byte,
UInt128
>(utf8Text, style, NumberFormatInfo.GetInstance(provider));
2183
public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
2190
public static
UInt128
Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider);
2193
public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out
UInt128
result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result);
2199
static bool IBinaryIntegerParseAndFormatInfo<
UInt128
>.IsSigned => false;
2201
static int IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxDigitCount => 39; // 340_282_366_920_938_463_463_374_607_431_768_211_455
2203
static int IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxHexDigitCount => 32; // 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
2205
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
2207
static string IBinaryIntegerParseAndFormatInfo<
UInt128
>.OverflowMessage => SR.Overflow_UInt128;
2209
static bool IBinaryIntegerParseAndFormatInfo<
UInt128
>.IsGreaterThanAsUnsigned(
UInt128
left,
UInt128
right) => left > right;
2211
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MultiplyBy10(
UInt128
value) => value * 10;
2213
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MultiplyBy16(
UInt128
value) => value * 16;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt16.cs (9)
737
else if (typeof(TOther) == typeof(
UInt128
))
739
UInt128
actualValue = (
UInt128
)(object)value;
804
else if (typeof(TOther) == typeof(
UInt128
))
806
UInt128
actualValue = (
UInt128
)(object)value;
871
else if (typeof(TOther) == typeof(
UInt128
))
873
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
802
else if (typeof(TOther) == typeof(
UInt128
))
804
UInt128
actualValue = (
UInt128
)(object)value;
869
else if (typeof(TOther) == typeof(
UInt128
))
871
UInt128
actualValue = (
UInt128
)(object)value;
936
else if (typeof(TOther) == typeof(
UInt128
))
938
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt64.cs (10)
51
public static
UInt128
BigMul(ulong left, ulong right) => Math.BigMul(left, right);
809
else if (typeof(TOther) == typeof(
UInt128
))
811
UInt128
actualValue = (
UInt128
)(object)value;
876
else if (typeof(TOther) == typeof(
UInt128
))
878
UInt128
actualValue = (
UInt128
)(object)value;
943
else if (typeof(TOther) == typeof(
UInt128
))
945
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (10)
186
UInt128
result = ulong.BigMul(left, right);
804
else if (typeof(TOther) == typeof(
UInt128
))
806
UInt128
actualValue = (
UInt128
)(object)value;
871
else if (typeof(TOther) == typeof(
UInt128
))
873
UInt128
actualValue = (
UInt128
)(object)value;
938
else if (typeof(TOther) == typeof(
UInt128
))
940
UInt128
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)
552
UInt128
p = (
UInt128
)bits[i] * multiplier + carry;
1497
UInt128
p = (
UInt128
)multiplier * bits2[i] + carry;
System\Numerics\BigInteger.cs (37)
2159
UInt128
uu;
2163
uu = 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>
2247
public static explicit operator
UInt128
(BigInteger value)
2251
return checked((
UInt128
)value._sign);
2266
: (
UInt128
)(ulong)value._bits[0];
2359
UInt128
x;
2362
x = (
UInt128
)(-value);
2367
x = (
UInt128
)value;
2424
/// <summary>Implicitly converts a <see cref="
UInt128
" /> value to a big integer.</summary>
2428
public static implicit operator BigInteger(
UInt128
value)
4179
else if (typeof(TOther) == typeof(
UInt128
))
4181
UInt128
actualValue = (
UInt128
)(object)value;
4302
else if (typeof(TOther) == typeof(
UInt128
))
4304
UInt128
actualValue = (
UInt128
)(object)value;
4425
else if (typeof(TOther) == typeof(
UInt128
))
4427
UInt128
actualValue = (
UInt128
)(object)value;
4550
else if (typeof(TOther) == typeof(
UInt128
))
4552
UInt128
actualResult = checked((
UInt128
)value);
4747
else if (typeof(TOther) == typeof(
UInt128
))
4749
UInt128
actualResult = (value >=
UInt128
.MaxValue) ?
UInt128
.MaxValue :
4750
IsNegative(value) ?
UInt128
.MinValue : (
UInt128
)value;
4955
UInt128
bits = new(upperBits, lowerBits);
5109
else if (typeof(TOther) == typeof(
UInt128
))
5111
UInt128
actualResult;
5149
UInt128
bits = new(upperBits, lowerBits);
5160
actualResult = (
UInt128
)(Int128)(long)value._sign;
System\Numerics\BigIntegerCalculator.PowMod.cs (10)
190
UInt128
prod = (
UInt128
)(ulong)result * (ulong)value;
195
UInt128
sq = (
UInt128
)(ulong)value * (ulong)value;
234
UInt128
prod = (
UInt128
)(ulong)result * (ulong)value;
240
UInt128
sq = (
UInt128
)(ulong)value * (ulong)value;
692
UInt128
p = (
UInt128
)m * modulus[j] + value[i + j] + carry;
System\Numerics\BigIntegerCalculator.SquMul.cs (7)
164
UInt128
carry = 0;
168
UInt128
digit1 = (
UInt128
)(ulong)bits[i + j] + carry;
169
UInt128
digit2 = (
UInt128
)(ulong)value[j] * (ulong)v;
177
UInt128
digits = (
UInt128
)(ulong)v * (ulong)v + carry;
System\Numerics\BigIntegerCalculator.Utils.cs (33)
198
UInt128
value = ((
UInt128
)(ulong)hi << 64) | (ulong)lo;
199
UInt128
digit = value / (ulong)divisor;
230
UInt128
p0 = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)carry;
233
UInt128
p1 = (
UInt128
)(ulong)left[i + 1] * (ulong)multiplier + (ulong)(p0 >> 64);
236
UInt128
p2 = (
UInt128
)(ulong)left[i + 2] * (ulong)multiplier + (ulong)(p1 >> 64);
239
UInt128
p3 = (
UInt128
)(ulong)left[i + 3] * (ulong)multiplier + (ulong)(p2 >> 64);
247
UInt128
product = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)carry;
284
UInt128
p0 = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)result[i] + (ulong)carry;
287
UInt128
p1 = (
UInt128
)(ulong)left[i + 1] * (ulong)multiplier + (ulong)result[i + 1] + (ulong)(p0 >> 64);
290
UInt128
p2 = (
UInt128
)(ulong)left[i + 2] * (ulong)multiplier + (ulong)result[i + 2] + (ulong)(p1 >> 64);
293
UInt128
p3 = (
UInt128
)(ulong)left[i + 3] * (ulong)multiplier + (ulong)result[i + 3] + (ulong)(p2 >> 64);
301
UInt128
product = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)result[i] + (ulong)carry;
336
UInt128
prod0 = (
UInt128
)(ulong)right[i] * (ulong)multiplier + (ulong)carry;
343
UInt128
prod1 = (
UInt128
)(ulong)right[i + 1] * (ulong)multiplier + (ulong)hi0;
350
UInt128
prod2 = (
UInt128
)(ulong)right[i + 2] * (ulong)multiplier + (ulong)hi1;
357
UInt128
prod3 = (
UInt128
)(ulong)right[i + 3] * (ulong)multiplier + (ulong)hi2;
369
UInt128
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>
800
public static explicit operator Complex(
UInt128
value)
1615
else if (typeof(TOther) == typeof(
UInt128
))
1617
UInt128
actualValue = (
UInt128
)(object)value;
1810
else if (typeof(TOther) == typeof(
UInt128
))
1817
UInt128
actualResult = checked((
UInt128
)value.m_real);
1968
else if (typeof(TOther) == typeof(
UInt128
))
1970
UInt128
actualResult = (value.m_real >= 340282366920938463463374607431768211455.0) ?
UInt128
.MaxValue :
1971
(value.m_real <= 0.0) ?
UInt128
.MinValue : (
UInt128
)value.m_real;
2110
else if (typeof(TOther) == typeof(
UInt128
))
2112
UInt128
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)
102
if (type == typeof(Half) || type == typeof(
UInt128
) || type == typeof(Int128))
System\Text\Json\Serialization\Converters\Value\UInt128Converter.cs (12)
12
internal sealed class UInt128Converter : JsonPrimitiveConverter<
UInt128
>
21
public override
UInt128
Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
36
public override void Write(Utf8JsonWriter writer,
UInt128
value, JsonSerializerOptions options)
47
private static unsafe
UInt128
ReadCore(ref Utf8JsonReader reader)
57
if (!
UInt128
.TryParse(buffer.Slice(0, written), CultureInfo.InvariantCulture, out
UInt128
result))
70
private static unsafe void WriteCore(Utf8JsonWriter writer,
UInt128
value)
77
internal override
UInt128
ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
83
internal override unsafe void WriteAsPropertyNameCore(Utf8JsonWriter writer,
UInt128
value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
90
internal override
UInt128
ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options)
106
internal override unsafe void WriteNumberWithCustomHandling(Utf8JsonWriter writer,
UInt128
value, JsonNumberHandling handling)
133
UInt128
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.
128
public static JsonConverter<
UInt128
> UInt128Converter => s_uint128Converter ??= new UInt128Converter();
129
private static JsonConverter<
UInt128
>? s_uint128Converter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
731
potentialNumberType == typeof(
UInt128
) ||