69 instantiations of UInt128
GenerateDocumentationAndConfigFiles (2)
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.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.UnitTests (2)
XxHash128Tests.cs (2)
51
Assert.Equal(new
UInt128
(test.HashHigh, test.HashLow), XxHash128.HashToUInt128(input, test.Seed));
129
Assert.Equal(new
UInt128
(test.HashHigh, test.HashLow), hash.GetCurrentHashAsUInt128());
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 (53)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (1)
189
return new
UInt128
(
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\libraries\System.Private.CoreLib\src\System\Decimal.cs (2)
1389
var significand = new
UInt128
(value._hi32, value._lo64);
1622
result = (actualValue >= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? MaxValue : (decimal)actualValue;
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\libraries\System.Private.CoreLib\src\System\Math.cs (1)
274
return new
UInt128
(high, low);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (1)
2447
UInt128 divisor = new
UInt128
(0, 10_000_000_000_000_000_000);
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (45)
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);
977
static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new
UInt128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
997
public static UInt128 operator &(UInt128 left, UInt128 right) => new
UInt128
(left._upper & right._upper, left._lower & right._lower);
1000
public static UInt128 operator |(UInt128 left, UInt128 right) => new
UInt128
(left._upper | right._upper, left._lower | right._lower);
1003
public static UInt128 operator ^(UInt128 left, UInt128 right) => new
UInt128
(left._upper ^ right._upper, left._lower ^ right._lower);
1006
public static UInt128 operator ~(UInt128 value) => new
UInt128
(~value._upper, ~value._lower);
1080
return new
UInt128
(highRes, X86Base.X64.DivRem(left._lower, remainder, right._lower).Quotient);
1256
return new
UInt128
(
1320
public static UInt128 MinValue => new
UInt128
(0, 0);
1323
public static UInt128 MaxValue => new
UInt128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1352
return new
UInt128
(upper, lower);
1386
lower = new
UInt128
(tl._lower, mull._lower);
1437
public static UInt128 One => new
UInt128
(0, 1);
1870
short actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_0000_7FFF)) ? short.MaxValue : (short)value;
1876
int actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_7FFF_FFFF)) ? int.MaxValue : (int)value;
1882
long actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? long.MaxValue : (long)value;
1888
Int128 actualResult = (value >= new
UInt128
(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? Int128.MaxValue : (Int128)value;
1899
nint actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? nint.MaxValue : (nint)value;
1906
sbyte actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_0000_007F)) ? sbyte.MaxValue : (sbyte)value;
2023
return new
UInt128
(upper, 0);
2033
return new
UInt128
(upper, lower);
2059
return new
UInt128
(0, lower);
2069
return new
UInt128
(upper, lower);
2101
return new
UInt128
(upper, lower);
2114
return new
UInt128
(upper, lower);
2168
static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new
UInt128
(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
System.Runtime.Numerics (6)
System\Numerics\BigInteger.cs (6)
1980
uu = new
UInt128
(
2098
return new
UInt128
(
2239
else if (x <= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF))
2323
else if (value <= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF))
5036
UInt128 bits = new
UInt128
(upperBits, lowerBits);
5217
UInt128 bits = new
UInt128
(upperBits, lowerBits);
Test.Utilities (2)
src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
776 references to UInt128
GenerateDocumentationAndConfigFiles (2)
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 (6)
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.Components.Endpoints.Tests (6)
Binding\FormDataMapperTests.cs (6)
2117
{ "101112", typeof(
UInt128
?), new
UInt128
?((
UInt128
)101112)},
2159
{ typeof(
UInt128
?) },
2202
{ "101112", typeof(
UInt128
), (
UInt128
)101112 },
Microsoft.AspNetCore.Http.Extensions (6)
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)
45
typeof(
UInt128
),
Microsoft.CodeAnalysis (2)
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)
67
yield return new TestData<
UInt128
>(42, """{"type":"integer"}""");
1212
[JsonSerializable(typeof(
UInt128
))]
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
67
yield return new TestData<
UInt128
>(42, """{"type":"integer"}""");
1212
[JsonSerializable(typeof(
UInt128
))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
72
typeof(T) == typeof(
UInt128
) ||
System.ComponentModel.TypeConverter (5)
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
166
[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 (11)
System\Net\IPNetwork.cs (11)
108
UInt128
baseAddressValue = default;
109
UInt128
otherAddressValue = default;
111
BaseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref baseAddressValue)), out int bytesWritten);
113
address.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref otherAddressValue)), out bytesWritten);
116
UInt128
mask =
UInt128
.MaxValue << (128 - PrefixLength);
263
UInt128
value = default;
264
baseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref value)), out int bytesWritten);
268
return value !=
UInt128
.Zero;
271
UInt128
mask =
UInt128
.MaxValue << (128 - prefixLength);
System.Numerics.Tensors (2)
System\Numerics\Tensors\netcore\TensorPrimitives.IsNegative.cs (1)
67
typeof(T) != typeof(
UInt128
);
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
78
typeof(T) == typeof(Int128) || typeof(T) == typeof(
UInt128
) ||
System.Private.CoreLib (646)
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (10)
286
public static byte[] GetBytes(
UInt128
value)
288
byte[] bytes = new byte[
UInt128
.Size];
301
public static bool TryWriteBytes(Span<byte> destination,
UInt128
value)
303
if (destination.Length <
UInt128
.Size)
668
public static
UInt128
ToUInt128(byte[] value, int startIndex)
674
if (startIndex > value.Length -
UInt128
.Size)
677
return Unsafe.ReadUnaligned<
UInt128
>(ref value[startIndex]);
688
public static
UInt128
ToUInt128(ReadOnlySpan<byte> value)
690
if (value.Length <
UInt128
.Size)
692
return Unsafe.ReadUnaligned<
UInt128
>(ref MemoryMarshal.GetReference(value));
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (9)
202
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as big endian.
208
/// <paramref name="source"/> is too small to contain a <see cref="
UInt128
" />.
212
public static
UInt128
ReadUInt128BigEndian(ReadOnlySpan<byte> source)
215
ReverseEndianness(MemoryMarshal.Read<
UInt128
>(source)) :
216
MemoryMarshal.Read<
UInt128
>(source);
482
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as big endian.
487
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
492
public static bool TryReadUInt128BigEndian(ReadOnlySpan<byte> source, out
UInt128
value)
496
bool success = MemoryMarshal.TryRead(source, out
UInt128
tmp);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (9)
202
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as little endian.
208
/// <paramref name="source"/> is too small to contain a <see cref="
UInt128
" />.
212
public static
UInt128
ReadUInt128LittleEndian(ReadOnlySpan<byte> source)
215
ReverseEndianness(MemoryMarshal.Read<
UInt128
>(source)) :
216
MemoryMarshal.Read<
UInt128
>(source);
482
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as little endian.
487
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
492
public static bool TryReadUInt128LittleEndian(ReadOnlySpan<byte> source, out
UInt128
value)
499
bool success = MemoryMarshal.TryRead(source, out
UInt128
tmp);
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\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (8)
268
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as big endian.
274
/// <paramref name="destination" /> is too small to contain a <see cref="
UInt128
" />.
278
public static void WriteUInt128BigEndian(Span<byte> destination,
UInt128
value)
282
UInt128
tmp = ReverseEndianness(value);
550
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as big endian.
555
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
560
public static bool TryWriteUInt128BigEndian(Span<byte> destination,
UInt128
value)
564
UInt128
tmp = ReverseEndianness(value);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (8)
268
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as little endian.
274
/// <paramref name="destination" /> is too small to contain a <see cref="
UInt128
" />.
278
public static void WriteUInt128LittleEndian(Span<byte> destination,
UInt128
value)
282
UInt128
tmp = ReverseEndianness(value);
550
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as little endian.
555
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
560
public static bool TryWriteUInt128LittleEndian(Span<byte> destination,
UInt128
value)
564
UInt128
tmp = ReverseEndianness(value);
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\libraries\System.Private.CoreLib\src\System\Byte.cs (9)
731
else if (typeof(TOther) == typeof(
UInt128
))
733
UInt128
actualValue = (
UInt128
)(object)value;
798
else if (typeof(TOther) == typeof(
UInt128
))
800
UInt128
actualValue = (
UInt128
)(object)value;
865
else if (typeof(TOther) == typeof(
UInt128
))
867
UInt128
actualValue = (
UInt128
)(object)value;
src\libraries\System.Private.CoreLib\src\System\Char.cs (9)
1585
else if (typeof(TOther) == typeof(
UInt128
))
1587
UInt128
actualValue = (
UInt128
)(object)value;
1648
else if (typeof(TOther) == typeof(
UInt128
))
1650
UInt128
actualValue = (
UInt128
)(object)value;
1711
else if (typeof(TOther) == typeof(
UInt128
))
1713
UInt128
actualValue = (
UInt128
)(object)value;
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (7)
1389
var
significand = new UInt128(value._hi32, value._lo64);
1543
else if (typeof(TOther) == typeof(
UInt128
))
1545
UInt128
actualValue = (
UInt128
)(object)value;
1619
else if (typeof(TOther) == typeof(
UInt128
))
1621
UInt128
actualValue = (
UInt128
)(object)value;
src\libraries\System.Private.CoreLib\src\System\Double.cs (6)
1346
else if (typeof(TOther) == typeof(
UInt128
))
1348
UInt128
actualResult = checked((
UInt128
)value);
1444
else if (typeof(TOther) == typeof(
UInt128
))
1446
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Half.cs (15)
945
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="
UInt128
"/>.</summary>
949
public static explicit operator
UInt128
(Half value) => (
UInt128
)(double)(value);
951
/// <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>
954
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
956
public static explicit operator checked
UInt128
(Half value) => checked((
UInt128
)(double)(value));
2048
else if (typeof(TOther) == typeof(
UInt128
))
2050
UInt128
actualResult = checked((
UInt128
)value);
2146
else if (typeof(TOther) == typeof(
UInt128
))
2148
UInt128
actualResult = (value == PositiveInfinity) ?
UInt128
.MaxValue :
2149
(value <= Zero) ?
UInt128
.MinValue : (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Int128.cs (36)
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)
1082
UInt128
result = (
UInt128
)(left) / (
UInt128
)(right);
1154
return (Int128)((
UInt128
)(left) * (
UInt128
)(right));
1187
UInt128
upper =
UInt128
.BigMul((
UInt128
)(left), (
UInt128
)(right), out
UInt128
ulower);
1756
else if (typeof(TOther) == typeof(
UInt128
))
1758
UInt128
actualResult = checked((
UInt128
)value);
1830
else if (typeof(TOther) == typeof(
UInt128
))
1832
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1900
else if (typeof(TOther) == typeof(
UInt128
))
1902
UInt128
actualResult = (
UInt128
)value;
2137
static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsGreaterThanAsUnsigned(Int128 left, Int128 right) => (
UInt128
)(left) > (
UInt128
)(right);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (10)
1147
else if (typeof(TOther) == typeof(
UInt128
))
1149
UInt128
actualResult = checked((
UInt128
)value);
1216
else if (typeof(TOther) == typeof(
UInt128
))
1218
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1284
else if (typeof(TOther) == typeof(
UInt128
))
1286
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Int32.cs (10)
1211
else if (typeof(TOther) == typeof(
UInt128
))
1213
UInt128
actualResult = checked((
UInt128
)value);
1282
else if (typeof(TOther) == typeof(
UInt128
))
1284
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1350
else if (typeof(TOther) == typeof(
UInt128
))
1352
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
1206
else if (typeof(TOther) == typeof(
UInt128
))
1208
UInt128
actualResult = checked((
UInt128
)value);
1278
else if (typeof(TOther) == typeof(
UInt128
))
1280
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1353
else if (typeof(TOther) == typeof(
UInt128
))
1355
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (10)
1202
else if (typeof(TOther) == typeof(
UInt128
))
1204
UInt128
actualResult = checked((
UInt128
)value);
1274
else if (typeof(TOther) == typeof(
UInt128
))
1276
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1342
else if (typeof(TOther) == typeof(
UInt128
))
1344
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
271
public static
UInt128
BigMul(ulong a, ulong b)
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (38)
1107
? UInt128ToDecStr((
UInt128
)value, digits: -1)
1123
? UInt128ToDecStr((
UInt128
)value, digits)
1170
? TryUInt128ToDecStr((
UInt128
)value, digits: -1, destination, out charsWritten)
1184
? TryUInt128ToDecStr((
UInt128
)value, digits, destination, out charsWritten)
1223
public static string FormatUInt128(
UInt128
value, string? format, IFormatProvider? provider)
1233
static unsafe string FormatUInt128Slow(
UInt128
value, string? format, IFormatProvider? provider)
1280
public static bool TryFormatUInt128<TChar>(
UInt128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1292
static unsafe bool TryFormatUInt128Slow(
UInt128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
2210
byte* p = UInt128ToDecChars(buffer + Int128Precision, (
UInt128
)value, 0);
2230
? UInt128ToDecStr((
UInt128
)value, -1)
2243
UInt128
absValue = (
UInt128
)(-value);
2271
UInt128
absValue = (
UInt128
)(-value);
2302
UInt128
uValue = (
UInt128
)value;
2323
UInt128
uValue = (
UInt128
)value;
2342
private static unsafe TChar* Int128ToHexChars<TChar>(TChar* buffer,
UInt128
value, int hexBase, int digits) where TChar : unmanaged, IUtfChar<TChar>
2365
UInt128
uValue = (
UInt128
)value;
2367
int bufferLength = Math.Max(digits, 128 - (int)
UInt128
.LeadingZeroCount((
UInt128
)value));
2386
UInt128
uValue = (
UInt128
)value;
2388
int bufferLength = Math.Max(digits, 128 - (int)
UInt128
.LeadingZeroCount((
UInt128
)value));
2405
private static unsafe TChar* UInt128ToBinaryChars<TChar>(TChar* buffer,
UInt128
value, int digits) where TChar : unmanaged, IUtfChar<TChar>
2421
private static unsafe void UInt128ToNumber(
UInt128
value, ref NumberBuffer number)
2445
private static ulong Int128DivMod1E19(ref
UInt128
value)
2447
UInt128
divisor = new UInt128(0, 10_000_000_000_000_000_000);
2448
(value,
UInt128
remainder) =
UInt128
.DivRem(value, divisor);
2453
internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd,
UInt128
value) where TChar : unmanaged, IUtfChar<TChar>
2465
internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd,
UInt128
value, int digits) where TChar : unmanaged, IUtfChar<TChar>
2477
internal static unsafe string UInt128ToDecStr(
UInt128
value)
2496
internal static unsafe string UInt128ToDecStr(
UInt128
value, int digits)
2514
private static unsafe bool TryUInt128ToDecStr<TChar>(
UInt128
value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (24)
421
/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="
UInt128
" /> value.</summary>
423
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="
UInt128
" /> value.</returns>
426
public static explicit operator
UInt128
(NFloat value) => (
UInt128
)(value._value);
428
/// <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>
430
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="
UInt128
" /> value.</returns>
431
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
434
public static explicit operator checked
UInt128
(NFloat value) => checked((
UInt128
)(value._value));
500
return -(NFloat)(
UInt128
)(value);
502
return (NFloat)(
UInt128
)(value);
545
/// <summary>Explicitly converts <see cref="
UInt128
"/> to its nearest representable native-sized floating-point value.</summary>
550
public static explicit operator NFloat(
UInt128
value) => (NFloat)(double)(value);
1507
else if (typeof(TOther) == typeof(
UInt128
))
1509
UInt128
actualValue = (
UInt128
)(object)value;
1620
else if (typeof(TOther) == typeof(
UInt128
))
1622
UInt128
actualResult = checked((
UInt128
)value);
1761
else if (typeof(TOther) == typeof(
UInt128
))
1763
UInt128
actualResult = (value >= 340282366920938463463374607431768211455.0) ?
UInt128
.MaxValue :
1764
(value <= 0.0) ?
UInt128
.MinValue : (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\SByte.cs (10)
1111
else if (typeof(TOther) == typeof(
UInt128
))
1113
UInt128
actualResult = checked((
UInt128
)value);
1179
else if (typeof(TOther) == typeof(
UInt128
))
1181
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1247
else if (typeof(TOther) == typeof(
UInt128
))
1249
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Single.cs (6)
1365
else if (typeof(TOther) == typeof(
UInt128
))
1367
UInt128
actualResult = checked((
UInt128
)value);
1463
else if (typeof(TOther) == typeof(
UInt128
))
1465
UInt128
actualResult = (
UInt128
)value;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5428
(sizeof(TResult) == sizeof(
UInt128
) && *(
UInt128
*)&result == default))
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (352)
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)
781
UInt128
quotient = left / right;
786
public static
UInt128
LeadingZeroCount(
UInt128
value)
791
private static int LeadingZeroCountAsInt32(
UInt128
value)
801
public static
UInt128
PopCount(
UInt128
value)
805
public static
UInt128
RotateLeft(
UInt128
value, int rotateAmount)
809
public static
UInt128
RotateRight(
UInt128
value, int rotateAmount)
813
public static
UInt128
TrailingZeroCount(
UInt128
value)
823
static bool IBinaryInteger<
UInt128
>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
UInt128
value)
825
UInt128
result = default;
854
result = Unsafe.ReadUnaligned<
UInt128
>(ref sourceRef);
880
static bool IBinaryInteger<
UInt128
>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
UInt128
value)
882
UInt128
result = default;
909
result = Unsafe.ReadUnaligned<
UInt128
>(ref sourceRef);
926
UInt128
part = Unsafe.Add(ref sourceRef, i);
938
int IBinaryInteger<
UInt128
>.GetShortestBitLength()
944
int IBinaryInteger<
UInt128
>.GetByteCount() => Size;
947
bool IBinaryInteger<
UInt128
>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
960
bool IBinaryInteger<
UInt128
>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
977
static
UInt128
IBinaryNumber<
UInt128
>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
980
public static bool IsPow2(
UInt128
value) => PopCount(value) == 1U;
983
public static
UInt128
Log2(
UInt128
value)
997
public static
UInt128
operator &(
UInt128
left,
UInt128
right) => new UInt128(left._upper & right._upper, left._lower & right._lower);
1000
public static
UInt128
operator |(
UInt128
left,
UInt128
right) => new UInt128(left._upper | right._upper, left._lower | right._lower);
1003
public static
UInt128
operator ^(
UInt128
left,
UInt128
right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower);
1006
public static
UInt128
operator ~(
UInt128
value) => new UInt128(~value._upper, ~value._lower);
1013
public static bool operator <(
UInt128
left,
UInt128
right)
1020
public static bool operator <=(
UInt128
left,
UInt128
right)
1027
public static bool operator >(
UInt128
left,
UInt128
right)
1034
public static bool operator >=(
UInt128
left,
UInt128
right)
1045
public static
UInt128
operator --(
UInt128
value) => value - One;
1048
public static
UInt128
operator checked --(
UInt128
value) => checked(value - One);
1055
public static
UInt128
operator /(
UInt128
left,
UInt128
right)
1130
unsafe static
UInt128
DivideSlow(
UInt128
quotient,
UInt128
divisor)
1293
public static
UInt128
operator checked /(
UInt128
left,
UInt128
right) => left / right;
1300
public static bool operator ==(
UInt128
left,
UInt128
right) => (left._lower == right._lower) && (left._upper == right._upper);
1303
public static bool operator !=(
UInt128
left,
UInt128
right) => (left._lower != right._lower) || (left._upper != right._upper);
1310
public static
UInt128
operator ++(
UInt128
value) => value + One;
1313
public static
UInt128
operator checked ++(
UInt128
value) => checked(value + One);
1320
public static
UInt128
MinValue => new UInt128(0, 0);
1323
public static
UInt128
MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1330
public static
UInt128
operator %(
UInt128
left,
UInt128
right)
1332
UInt128
quotient = left / right;
1341
static
UInt128
IMultiplicativeIdentity<
UInt128
,
UInt128
>.MultiplicativeIdentity => One;
1348
public static
UInt128
operator *(
UInt128
left,
UInt128
right)
1356
public static
UInt128
operator checked *(
UInt128
left,
UInt128
right)
1358
UInt128
upper = BigMul(left, right, out
UInt128
lower);
1368
internal static
UInt128
BigMul(
UInt128
left,
UInt128
right, out
UInt128
lower)
1382
UInt128
mull = Math.BigMul(al, bl);
1383
UInt128
t = Math.BigMul(ah, bl) + mull._upper;
1384
UInt128
tl = Math.BigMul(al, bh) + t._lower;
1395
public static
UInt128
Clamp(
UInt128
value,
UInt128
min,
UInt128
max)
1415
static
UInt128
INumber<
UInt128
>.CopySign(
UInt128
value,
UInt128
sign) => value;
1418
public static
UInt128
Max(
UInt128
x,
UInt128
y) => (x >= y) ? x : y;
1421
static
UInt128
INumber<
UInt128
>.MaxNumber(
UInt128
x,
UInt128
y) => Max(x, y);
1424
public static
UInt128
Min(
UInt128
x,
UInt128
y) => (x <= y) ? x : y;
1427
static
UInt128
INumber<
UInt128
>.MinNumber(
UInt128
x,
UInt128
y) => Min(x, y);
1430
public static int Sign(
UInt128
value) => (value == 0U) ? 0 : 1;
1437
public static
UInt128
One => new UInt128(0, 1);
1440
static int INumberBase<
UInt128
>.Radix => 2;
1443
public static
UInt128
Zero => default;
1446
static
UInt128
INumberBase<
UInt128
>.Abs(
UInt128
value) => value;
1450
public static
UInt128
CreateChecked<TOther>(TOther value)
1453
UInt128
result;
1455
if (typeof(TOther) == typeof(
UInt128
))
1457
result = (
UInt128
)(object)value;
1469
public static
UInt128
CreateSaturating<TOther>(TOther value)
1472
UInt128
result;
1474
if (typeof(TOther) == typeof(
UInt128
))
1476
result = (
UInt128
)(object)value;
1488
public static
UInt128
CreateTruncating<TOther>(TOther value)
1491
UInt128
result;
1493
if (typeof(TOther) == typeof(
UInt128
))
1495
result = (
UInt128
)(object)value;
1506
static bool INumberBase<
UInt128
>.IsCanonical(
UInt128
value) => true;
1509
static bool INumberBase<
UInt128
>.IsComplexNumber(
UInt128
value) => false;
1512
public static bool IsEvenInteger(
UInt128
value) => (value._lower & 1) == 0;
1515
static bool INumberBase<
UInt128
>.IsFinite(
UInt128
value) => true;
1518
static bool INumberBase<
UInt128
>.IsImaginaryNumber(
UInt128
value) => false;
1521
static bool INumberBase<
UInt128
>.IsInfinity(
UInt128
value) => false;
1524
static bool INumberBase<
UInt128
>.IsInteger(
UInt128
value) => true;
1527
static bool INumberBase<
UInt128
>.IsNaN(
UInt128
value) => false;
1530
static bool INumberBase<
UInt128
>.IsNegative(
UInt128
value) => false;
1533
static bool INumberBase<
UInt128
>.IsNegativeInfinity(
UInt128
value) => false;
1536
static bool INumberBase<
UInt128
>.IsNormal(
UInt128
value) => value != 0U;
1539
public static bool IsOddInteger(
UInt128
value) => (value._lower & 1) != 0;
1542
static bool INumberBase<
UInt128
>.IsPositive(
UInt128
value) => true;
1545
static bool INumberBase<
UInt128
>.IsPositiveInfinity(
UInt128
value) => false;
1548
static bool INumberBase<
UInt128
>.IsRealNumber(
UInt128
value) => true;
1551
static bool INumberBase<
UInt128
>.IsSubnormal(
UInt128
value) => false;
1554
static bool INumberBase<
UInt128
>.IsZero(
UInt128
value) => (value == 0U);
1557
static
UInt128
INumberBase<
UInt128
>.MaxMagnitude(
UInt128
x,
UInt128
y) => Max(x, y);
1560
static
UInt128
INumberBase<
UInt128
>.MaxMagnitudeNumber(
UInt128
x,
UInt128
y) => Max(x, y);
1563
static
UInt128
INumberBase<
UInt128
>.MinMagnitude(
UInt128
x,
UInt128
y) => Min(x, y);
1566
static
UInt128
INumberBase<
UInt128
>.MinMagnitudeNumber(
UInt128
x,
UInt128
y) => Min(x, y);
1569
static
UInt128
INumberBase<
UInt128
>.MultiplyAddEstimate(
UInt128
left,
UInt128
right,
UInt128
addend) => (left * right) + addend;
1573
static bool INumberBase<
UInt128
>.TryConvertFromChecked<TOther>(TOther value, out
UInt128
result) => TryConvertFromChecked(value, out result);
1576
private static bool TryConvertFromChecked<TOther>(TOther value, out
UInt128
result)
1603
result = checked((
UInt128
)actualValue);
1639
static bool INumberBase<
UInt128
>.TryConvertFromSaturating<TOther>(TOther value, out
UInt128
result) => TryConvertFromSaturating(value, out result);
1642
private static bool TryConvertFromSaturating<TOther>(TOther value, out
UInt128
result)
1669
result = (actualValue < 0) ? MinValue : (
UInt128
)actualValue;
1705
static bool INumberBase<
UInt128
>.TryConvertFromTruncating<TOther>(TOther value, out
UInt128
result) => TryConvertFromTruncating(value, out result);
1708
private static bool TryConvertFromTruncating<TOther>(TOther value, out
UInt128
result)
1735
result = (actualValue < 0) ? MinValue : (
UInt128
)actualValue;
1771
static bool INumberBase<
UInt128
>.TryConvertToChecked<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
1845
static bool INumberBase<
UInt128
>.TryConvertToSaturating<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
1925
static bool INumberBase<
UInt128
>.TryConvertToTruncating<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
2002
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2009
public static
UInt128
operator <<(
UInt128
value, int shiftAmount)
2042
public static
UInt128
operator >>(
UInt128
value, int shiftAmount) => value >>> shiftAmount;
2045
public static
UInt128
operator >>>(
UInt128
value, int shiftAmount)
2082
public static
UInt128
Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
2085
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2092
public static
UInt128
operator -(
UInt128
left,
UInt128
right)
2105
public static
UInt128
operator checked -(
UInt128
left,
UInt128
right)
2122
public static
UInt128
operator -(
UInt128
value) => Zero - value;
2125
public static
UInt128
operator checked -(
UInt128
value) => checked(Zero - value);
2132
public static
UInt128
operator +(
UInt128
value) => value;
2139
public static
UInt128
Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
2142
return Number.ParseBinaryInteger<byte,
UInt128
>(utf8Text, style, NumberFormatInfo.GetInstance(provider));
2146
public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
2153
public static
UInt128
Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider);
2156
public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out
UInt128
result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result);
2162
static bool IBinaryIntegerParseAndFormatInfo<
UInt128
>.IsSigned => false;
2164
static int IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxDigitCount => 39; // 340_282_366_920_938_463_463_374_607_431_768_211_455
2166
static int IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxHexDigitCount => 32; // 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
2168
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
2170
static string IBinaryIntegerParseAndFormatInfo<
UInt128
>.OverflowMessage => SR.Overflow_UInt128;
2172
static bool IBinaryIntegerParseAndFormatInfo<
UInt128
>.IsGreaterThanAsUnsigned(
UInt128
left,
UInt128
right) => left > right;
2174
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MultiplyBy10(
UInt128
value) => value * 10;
2176
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MultiplyBy16(
UInt128
value) => value * 16;
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (9)
750
else if (typeof(TOther) == typeof(
UInt128
))
752
UInt128
actualValue = (
UInt128
)(object)value;
817
else if (typeof(TOther) == typeof(
UInt128
))
819
UInt128
actualValue = (
UInt128
)(object)value;
884
else if (typeof(TOther) == typeof(
UInt128
))
886
UInt128
actualValue = (
UInt128
)(object)value;
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
789
else if (typeof(TOther) == typeof(
UInt128
))
791
UInt128
actualValue = (
UInt128
)(object)value;
856
else if (typeof(TOther) == typeof(
UInt128
))
858
UInt128
actualValue = (
UInt128
)(object)value;
923
else if (typeof(TOther) == typeof(
UInt128
))
925
UInt128
actualValue = (
UInt128
)(object)value;
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (10)
51
public static
UInt128
BigMul(ulong left, ulong right) => Math.BigMul(left, right);
788
else if (typeof(TOther) == typeof(
UInt128
))
790
UInt128
actualValue = (
UInt128
)(object)value;
855
else if (typeof(TOther) == typeof(
UInt128
))
857
UInt128
actualValue = (
UInt128
)(object)value;
922
else if (typeof(TOther) == typeof(
UInt128
))
924
UInt128
actualValue = (
UInt128
)(object)value;
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (9)
797
else if (typeof(TOther) == typeof(
UInt128
))
799
UInt128
actualValue = (
UInt128
)(object)value;
864
else if (typeof(TOther) == typeof(
UInt128
))
866
UInt128
actualValue = (
UInt128
)(object)value;
931
else if (typeof(TOther) == typeof(
UInt128
))
933
UInt128
actualValue = (
UInt128
)(object)value;
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
867
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
UInt128
))]
System.Runtime.Numerics (51)
System\Numerics\BigInteger.cs (33)
1976
UInt128
uu;
2076
/// <summary>Explicitly converts a big integer to a <see cref="
UInt128
" /> value.</summary>
2078
/// <returns><paramref name="value" /> converted to <see cref="
UInt128
" /> value.</returns>
2080
public static explicit operator
UInt128
(BigInteger value)
2086
return checked((
UInt128
)value._sign);
2216
UInt128
x;
2219
x = unchecked((
UInt128
)(-value));
2224
x = (
UInt128
)value;
2298
/// <summary>Implicitly converts a <see cref="
UInt128
" /> value to a big integer.</summary>
2302
public static implicit operator BigInteger(
UInt128
value)
4311
else if (typeof(TOther) == typeof(
UInt128
))
4313
UInt128
actualValue = (
UInt128
)(object)value;
4428
else if (typeof(TOther) == typeof(
UInt128
))
4430
UInt128
actualValue = (
UInt128
)(object)value;
4545
else if (typeof(TOther) == typeof(
UInt128
))
4547
UInt128
actualValue = (
UInt128
)(object)value;
4664
else if (typeof(TOther) == typeof(
UInt128
))
4666
UInt128
actualResult = checked((
UInt128
)value);
4855
else if (typeof(TOther) == typeof(
UInt128
))
4857
UInt128
actualResult = (value >=
UInt128
.MaxValue) ?
UInt128
.MaxValue :
4858
IsNegative(value) ?
UInt128
.MinValue : (
UInt128
)value;
5036
UInt128
bits = new UInt128(upperBits, lowerBits);
5189
else if (typeof(TOther) == typeof(
UInt128
))
5191
UInt128
actualResult;
5217
UInt128
bits = new UInt128(upperBits, lowerBits);
5228
actualResult = (
UInt128
)value._sign;
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)
1591
else if (typeof(TOther) == typeof(
UInt128
))
1593
UInt128
actualValue = (
UInt128
)(object)value;
1780
else if (typeof(TOther) == typeof(
UInt128
))
1787
UInt128
actualResult = checked((
UInt128
)value.m_real);
1932
else if (typeof(TOther) == typeof(
UInt128
))
1934
UInt128
actualResult = (value.m_real >= 340282366920938463463374607431768211455.0) ?
UInt128
.MaxValue :
1935
(value.m_real <= 0.0) ?
UInt128
.MinValue : (
UInt128
)value.m_real;
2068
else if (typeof(TOther) == typeof(
UInt128
))
2070
UInt128
actualResult = (value.m_real >= 340282366920938463463374607431768211455.0) ?
UInt128
.MaxValue :
2071
(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)
31
public override void Write(Utf8JsonWriter writer,
UInt128
value, JsonSerializerOptions options)
36
private static
UInt128
ReadCore(ref Utf8JsonReader reader)
46
if (!
UInt128
.TryParse(buffer.Slice(0, written), CultureInfo.InvariantCulture, out
UInt128
result))
59
private static void WriteCore(Utf8JsonWriter writer,
UInt128
value)
66
internal override
UInt128
ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
72
internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer,
UInt128
value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
79
internal override
UInt128
ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options)
90
internal override void WriteNumberWithCustomHandling(Utf8JsonWriter writer,
UInt128
value, JsonNumberHandling handling)
114
UInt128
value, out int written)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
120
/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="
UInt128
"/> values.
124
public static JsonConverter<
UInt128
> UInt128Converter => s_uint128Converter ??= new UInt128Converter();
125
private static JsonConverter<
UInt128
>? s_uint128Converter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
731
potentialNumberType == typeof(
UInt128
) ||
Test.Utilities (2)
src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()