44 instantiations of Int128
System.Private.CoreLib (40)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (1)
77
return new
Int128
(
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (36)
468
Int128 result = new
Int128
(value.High, value.Low64);
545
Int128 result = new
Int128
((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000);
579
public static implicit operator Int128(byte value) => new
Int128
(0, value);
584
public static implicit operator Int128(char value) => new
Int128
(0, value);
592
return new
Int128
((ulong)(lower >> 63), (ulong)lower);
601
return new
Int128
((ulong)(lower >> 63), (ulong)lower);
610
return new
Int128
((ulong)(lower >> 63), (ulong)lower);
619
return new
Int128
((ulong)(lower >> 63), (ulong)lower);
629
return new
Int128
((ulong)(lower >> 63), (ulong)lower);
636
public static implicit operator Int128(ushort value) => new
Int128
(0, value);
642
public static implicit operator Int128(uint value) => new
Int128
(0, value);
648
public static implicit operator Int128(ulong value) => new
Int128
(0, value);
654
public static implicit operator Int128(nuint value) => new
Int128
(0, value);
670
return new
Int128
(upper, lower);
955
static Int128 IBinaryNumber<Int128>.AllBitsSet => new
Int128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
980
public static Int128 operator &(Int128 left, Int128 right) => new
Int128
(left._upper & right._upper, left._lower & right._lower);
983
public static Int128 operator |(Int128 left, Int128 right) => new
Int128
(left._upper | right._upper, left._lower | right._lower);
986
public static Int128 operator ^(Int128 left, Int128 right) => new
Int128
(left._upper ^ right._upper, left._lower ^ right._lower);
989
public static Int128 operator ~(Int128 value) => new
Int128
(~value._upper, ~value._lower);
1077
return new
Int128
(
1111
public static Int128 MinValue => new
Int128
(0x8000_0000_0000_0000, 0);
1114
public static Int128 MaxValue => new
Int128
(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1261
public static Int128 One => new
Int128
(0, 1);
1794
decimal actualResult = (value >= new
Int128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue :
1795
(value <= new
Int128
(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value;
1867
decimal actualResult = (value >= new
Int128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue :
1868
(value <= new
Int128
(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value;
1956
return new
Int128
(upper, 0);
1966
return new
Int128
(upper, lower);
1991
return new
Int128
(upper, lower);
2001
return new
Int128
(upper, lower);
2024
return new
Int128
(0, lower);
2034
return new
Int128
(upper, lower);
2047
public static Int128 NegativeOne => new
Int128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
2073
return new
Int128
(upper, lower);
2144
static Int128 IBinaryIntegerParseAndFormatInfo<Int128>.MaxValueDiv10 => new
Int128
(0x0CCC_CCCC_CCCC_CCCC, 0xCCCC_CCCC_CCCC_CCCC);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
295
return new
Int128
((ulong)high, (ulong)low);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (2)
342
public static explicit operator Int128(UInt128 value) => new
Int128
(value._upper, value._lower);
355
return new
Int128
(value._upper, value._lower);
System.Runtime.Numerics (4)
System\Numerics\BigInteger.cs (4)
4801
decimal actualResult = (value >= new
Int128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue :
4802
(value <= new
Int128
(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value;
5012
decimal actualResult = (value >= new
Int128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue :
5013
(value <= new
Int128
(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value;
765 references to Int128
Microsoft.AspNetCore.Components.Endpoints (7)
FormMapping\Converters\NullableConverter.cs (1)
71
type == typeof(
Int128
) ||
FormMapping\WellKnownConverters.cs (6)
31
{ typeof(
Int128
), new ParsableConverter<
Int128
>() },
63
converters.Add(typeof(
Int128
?), new NullableConverter<
Int128
>((FormDataConverter<
Int128
>)converters[typeof(
Int128
)]));
Microsoft.AspNetCore.Http.Extensions (7)
src\aspnetcore\src\Components\Endpoints\src\FormMapping\Converters\NullableConverter.cs (1)
71
type == typeof(
Int128
) ||
src\aspnetcore\src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
31
{ typeof(
Int128
), new ParsableConverter<
Int128
>() },
63
converters.Add(typeof(
Int128
?), new NullableConverter<
Int128
>((FormDataConverter<
Int128
>)converters[typeof(
Int128
)]));
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiConstants.cs (1)
35
typeof(
Int128
),
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
65
yield return new TestData<
Int128
>(42, """{"type":"integer"}""");
1225
[JsonSerializable(typeof(
Int128
))]
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
65
yield return new TestData<
Int128
>(42, """{"type":"integer"}""");
1225
[JsonSerializable(typeof(
Int128
))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
70
typeof(T) == typeof(
Int128
) ||
System.ComponentModel.TypeConverter (5)
System\ComponentModel\Int128Converter.cs (4)
18
internal override Type TargetType => typeof(
Int128
);
28
return
Int128
.Parse(value, NumberStyles.HexNumber);
35
Int128
.Parse(value, formatInfo);
41
((
Int128
)value).ToString(formatInfo);
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
160
[typeof(
Int128
)] = new IntrinsicTypeConverterData((type) => new Int128Converter()),
System.Linq (7)
System\Linq\Max.cs (2)
352
if (typeof(TSource) == typeof(
Int128
)) return (TSource)(object)MaxIntegerEnumerator((IEnumerable<
Int128
>)source);
System\Linq\Min.cs (2)
331
if (typeof(TSource) == typeof(
Int128
)) return (TSource)(object)MinIntegerEnumerator((IEnumerable<
Int128
>)source);
System\Linq\OrderBy.cs (1)
161
t == typeof(
Int128
) || t == typeof(UInt128) ||
System\Linq\Sequence.cs (2)
92
if (typeof(T) == typeof(long) && (range = TryUseRange<
Int128
>(start, endInclusive, step, long.MaxValue)) is not null) return range;
94
if (typeof(T) == typeof(nint) && (range = TryUseRange<
Int128
>(start, endInclusive, step, nint.MaxValue)) is not null) return range;
System.Numerics.Tensors (1)
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
77
typeof(T) == typeof(
Int128
) || typeof(T) == typeof(UInt128) ||
System.Private.CoreLib (665)
src\runtime\src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (10)
168
public static byte[] GetBytes(
Int128
value)
170
byte[] bytes = new byte[
Int128
.Size];
182
public static bool TryWriteBytes(Span<byte> destination,
Int128
value)
184
if (destination.Length <
Int128
.Size)
571
public static
Int128
ToInt128(byte[] value, int startIndex)
577
if (startIndex > value.Length -
Int128
.Size)
580
return Unsafe.ReadUnaligned<
Int128
>(ref value[startIndex]);
590
public static
Int128
ToInt128(ReadOnlySpan<byte> value)
592
if (value.Length <
Int128
.Size)
594
return Unsafe.ReadUnaligned<
Int128
>(ref MemoryMarshal.GetReference(value));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (9)
115
/// Reads a <see cref="
Int128
" /> from the beginning of a read-only span of bytes, as big endian.
121
/// <paramref name="source"/> is too small to contain a <see cref="
Int128
" />.
124
public static
Int128
ReadInt128BigEndian(ReadOnlySpan<byte> source)
127
ReverseEndianness(MemoryMarshal.Read<
Int128
>(source)) :
128
MemoryMarshal.Read<
Int128
>(source);
388
/// Reads a <see cref="
Int128
" /> from the beginning of a read-only span of bytes, as big endian.
393
/// <see langword="true" /> if the span is large enough to contain a <see cref="
Int128
" />; otherwise, <see langword="false" />.
397
public static bool TryReadInt128BigEndian(ReadOnlySpan<byte> source, out
Int128
value)
401
bool success = MemoryMarshal.TryRead(source, out
Int128
tmp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (9)
115
/// Reads a <see cref="
Int128
" /> from the beginning of a read-only span of bytes, as little endian.
121
/// <paramref name="source"/> is too small to contain a <see cref="
Int128
" />.
124
public static
Int128
ReadInt128LittleEndian(ReadOnlySpan<byte> source)
127
ReverseEndianness(MemoryMarshal.Read<
Int128
>(source)) :
128
MemoryMarshal.Read<
Int128
>(source);
388
/// Reads a <see cref="
Int128
" /> from the beginning of a read-only span of bytes, as little endian.
393
/// <see langword="true" /> if the span is large enough to contain a <see cref="
Int128
" />; otherwise, <see langword="false" />.
397
public static bool TryReadInt128LittleEndian(ReadOnlySpan<byte> source, out
Int128
value)
404
bool success = MemoryMarshal.TryRead(source, out
Int128
tmp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (7)
70
/// Reverses a primitive value by performing an endianness swap of the specified <see cref="
Int128
" /> value.
75
public static
Int128
ReverseEndianness(
Int128
value)
376
ReverseEndianness(MemoryMarshal.Cast<UInt128,
Int128
>(source), MemoryMarshal.Cast<UInt128,
Int128
>(destination));
379
public static void ReverseEndianness(ReadOnlySpan<
Int128
> source, Span<
Int128
> destination)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (8)
151
/// Writes a <see cref="
Int128
" /> into a span of bytes, as big endian.
157
/// <paramref name="destination" /> is too small to contain a <see cref="
Int128
" />.
160
public static void WriteInt128BigEndian(Span<byte> destination,
Int128
value)
164
Int128
tmp = ReverseEndianness(value);
466
/// Writes a <see cref="
Int128
" /> into a span of bytes, as big endian.
471
/// <see langword="true" /> if the span is large enough to contain a <see cref="
Int128
" />; otherwise, <see langword="false" />.
475
public static bool TryWriteInt128BigEndian(Span<byte> destination,
Int128
value)
479
Int128
tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (8)
151
/// Writes a <see cref="
Int128
" /> into a span of bytes, as little endian.
157
/// <paramref name="destination" /> is too small to contain a <see cref="
Int128
" />.
160
public static void WriteInt128LittleEndian(Span<byte> destination,
Int128
value)
164
Int128
tmp = ReverseEndianness(value);
466
/// Writes a <see cref="
Int128
" /> into a span of bytes, as little endian.
471
/// <see langword="true" /> if the span is large enough to contain a <see cref="
Int128
" />; otherwise, <see langword="false" />.
475
public static bool TryWriteInt128LittleEndian(Span<byte> destination,
Int128
value)
479
Int128
tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Byte.cs (6)
922
else if (typeof(TOther) == typeof(
Int128
))
924
Int128
actualResult = value;
996
else if (typeof(TOther) == typeof(
Int128
))
998
Int128
actualResult = value;
1070
else if (typeof(TOther) == typeof(
Int128
))
1072
Int128
actualResult = value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (6)
1794
else if (typeof(TOther) == typeof(
Int128
))
1796
Int128
actualResult = value;
1868
else if (typeof(TOther) == typeof(
Int128
))
1870
Int128
actualResult = value;
1942
else if (typeof(TOther) == typeof(
Int128
))
1944
Int128
actualResult = value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (6)
1652
else if (typeof(TOther) == typeof(
Int128
))
1654
Int128
actualResult = checked((
Int128
)value);
1743
else if (typeof(TOther) == typeof(
Int128
))
1745
Int128
actualResult = (
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (3)
1282
else if (typeof(TOther) == typeof(
Int128
))
1284
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Half.cs (10)
870
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="
Int128
"/>.</summary>
873
public static explicit operator
Int128
(Half value) => (
Int128
)(double)(value);
875
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="
Int128
"/>, throwing an overflow exception for any values that fall outside the representable range.</summary>
878
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
879
public static explicit operator checked
Int128
(Half value) => checked((
Int128
)(double)(value));
1964
else if (typeof(TOther) == typeof(
Int128
))
1966
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (353)
18
: IBinaryInteger<
Int128
>,
19
IMinMaxValue<
Int128
>,
20
ISignedNumber<
Int128
>,
22
IBinaryIntegerParseAndFormatInfo<
Int128
>
34
/// <summary>Initializes a new instance of the <see cref="
Int128
" /> struct.</summary>
51
if (value is
Int128
other)
66
public int CompareTo(
Int128
value)
85
return (obj is
Int128
other) && Equals(other);
89
public bool Equals(
Int128
other)
129
public static
Int128
Parse(string s) => Parse(s, NumberStyles.Integer, provider: null);
131
public static
Int128
Parse(string s, NumberStyles style) => Parse(s, style, provider: null);
133
public static
Int128
Parse(string s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
135
public static
Int128
Parse(string s, NumberStyles style, IFormatProvider? provider)
141
public static
Int128
Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
144
return Number.ParseBinaryInteger<char,
Int128
>(s, style, NumberFormatInfo.GetInstance(provider));
147
public static bool TryParse([NotNullWhen(true)] string? s, out
Int128
result) => TryParse(s, NumberStyles.Integer, provider: null, out result);
149
public static bool TryParse(ReadOnlySpan<char> s, out
Int128
result) => TryParse(s, NumberStyles.Integer, provider: null, out result);
155
public static bool TryParse(ReadOnlySpan<byte> utf8Text, out
Int128
result) => TryParse(utf8Text, NumberStyles.Integer, provider: null, out result);
157
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out
Int128
result)
163
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out
Int128
result)
176
public static explicit operator byte(
Int128
value) => (byte)value._lower;
181
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
182
public static explicit operator checked byte(
Int128
value)
194
public static explicit operator char(
Int128
value) => (char)value._lower;
199
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
200
public static explicit operator checked char(
Int128
value)
212
public static explicit operator decimal(
Int128
value)
225
public static explicit operator double(
Int128
value)
238
public static explicit operator Half(
Int128
value)
251
public static explicit operator short(
Int128
value) => (short)value._lower;
256
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
257
public static explicit operator checked short(
Int128
value)
270
public static explicit operator int(
Int128
value) => (int)value._lower;
275
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
276
public static explicit operator checked int(
Int128
value)
289
public static explicit operator long(
Int128
value) => (long)value._lower;
294
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
295
public static explicit operator checked long(
Int128
value)
308
public static explicit operator nint(
Int128
value) => (nint)value._lower;
313
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
314
public static explicit operator checked nint(
Int128
value)
328
public static explicit operator sbyte(
Int128
value) => (sbyte)value._lower;
333
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
335
public static explicit operator checked sbyte(
Int128
value)
348
public static explicit operator float(
Int128
value)
362
public static explicit operator ushort(
Int128
value) => (ushort)value._lower;
367
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
369
public static explicit operator checked ushort(
Int128
value)
382
public static explicit operator uint(
Int128
value) => (uint)value._lower;
387
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
389
public static explicit operator checked uint(
Int128
value)
402
public static explicit operator ulong(
Int128
value) => value._lower;
407
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
409
public static explicit operator checked ulong(
Int128
value)
422
public static explicit operator UInt128(
Int128
value) => new UInt128(value._upper, value._lower);
427
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
429
public static explicit operator checked UInt128(
Int128
value)
442
public static explicit operator nuint(
Int128
value) => (nuint)value._lower;
447
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
449
public static explicit operator checked nuint(
Int128
value)
465
public static explicit operator
Int128
(decimal value)
468
Int128
result = new Int128(value.High, value.Low64);
480
public static explicit operator
Int128
(double value)
503
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
504
public static explicit operator checked
Int128
(double value)
516
internal static
Int128
ToInt128(double value)
545
Int128
result = new Int128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000);
564
public static explicit operator
Int128
(float value) => (
Int128
)(double)(value);
569
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
570
public static explicit operator checked
Int128
(float value) => checked((
Int128
)(double)(value));
579
public static implicit operator
Int128
(byte value) => new Int128(0, value);
584
public static implicit operator
Int128
(char value) => new Int128(0, value);
589
public static implicit operator
Int128
(short value)
598
public static implicit operator
Int128
(int value)
607
public static implicit operator
Int128
(long value)
616
public static implicit operator
Int128
(nint value)
626
public static implicit operator
Int128
(sbyte value)
636
public static implicit operator
Int128
(ushort value) => new Int128(0, value);
642
public static implicit operator
Int128
(uint value) => new Int128(0, value);
648
public static implicit operator
Int128
(ulong value) => new Int128(0, value);
654
public static implicit operator
Int128
(nuint value) => new Int128(0, value);
661
public static
Int128
operator +(
Int128
left,
Int128
right)
674
public static
Int128
operator checked +(
Int128
left,
Int128
right)
681
Int128
result = left + right;
695
static
Int128
IAdditiveIdentity<
Int128
,
Int128
>.AdditiveIdentity => default;
702
public static (
Int128
Quotient,
Int128
Remainder) DivRem(
Int128
left,
Int128
right)
704
Int128
quotient = left / right;
709
public static
Int128
LeadingZeroCount(
Int128
value)
714
private static int LeadingZeroCountAsInt32(
Int128
value)
724
public static
Int128
Log10(
Int128
value)
730
return (
Int128
)UInt128.Log10((UInt128)value);
734
public static
Int128
PopCount(
Int128
value)
738
public static
Int128
RotateLeft(
Int128
value, int rotateAmount)
742
public static
Int128
RotateRight(
Int128
value, int rotateAmount)
746
public static
Int128
TrailingZeroCount(
Int128
value)
756
static bool IBinaryInteger<
Int128
>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
Int128
value)
758
Int128
result = default;
829
static bool IBinaryInteger<
Int128
>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
Int128
value)
831
Int128
result = default;
907
int IBinaryInteger<
Int128
>.GetShortestBitLength()
909
Int128
value = this;
922
int IBinaryInteger<
Int128
>.GetByteCount() => Size;
925
bool IBinaryInteger<
Int128
>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
938
bool IBinaryInteger<
Int128
>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
955
static
Int128
IBinaryNumber<
Int128
>.AllBitsSet => new Int128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
958
public static bool IsPow2(
Int128
value) => (PopCount(value) == 1U) && IsPositive(value);
961
public static
Int128
Log2(
Int128
value)
980
public static
Int128
operator &(
Int128
left,
Int128
right) => new Int128(left._upper & right._upper, left._lower & right._lower);
983
public static
Int128
operator |(
Int128
left,
Int128
right) => new Int128(left._upper | right._upper, left._lower | right._lower);
986
public static
Int128
operator ^(
Int128
left,
Int128
right) => new Int128(left._upper ^ right._upper, left._lower ^ right._lower);
989
public static
Int128
operator ~(
Int128
value) => new Int128(~value._upper, ~value._lower);
996
public static bool operator <(
Int128
left,
Int128
right)
1010
public static bool operator <=(
Int128
left,
Int128
right)
1018
public static bool operator >(
Int128
left,
Int128
right)
1026
public static bool operator >=(
Int128
left,
Int128
right)
1038
public static
Int128
operator --(
Int128
value) => value - One;
1041
public static
Int128
operator checked --(
Int128
value) => checked(value - One);
1048
public static
Int128
operator /(
Int128
left,
Int128
right)
1084
public static
Int128
operator checked /(
Int128
left,
Int128
right) => left / right;
1091
public static bool operator ==(
Int128
left,
Int128
right) => (left._lower == right._lower) && (left._upper == right._upper);
1094
public static bool operator !=(
Int128
left,
Int128
right) => (left._lower != right._lower) || (left._upper != right._upper);
1101
public static
Int128
operator ++(
Int128
value) => value + One;
1104
public static
Int128
operator checked ++(
Int128
value) => checked(value + One);
1111
public static
Int128
MinValue => new Int128(0x8000_0000_0000_0000, 0);
1114
public static
Int128
MaxValue => new Int128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1121
public static
Int128
operator %(
Int128
left,
Int128
right)
1123
Int128
quotient = left / right;
1132
static
Int128
IMultiplicativeIdentity<
Int128
,
Int128
>.MultiplicativeIdentity => One;
1139
public static
Int128
operator *(
Int128
left,
Int128
right)
1142
return (
Int128
)((UInt128)(left) * (UInt128)(right));
1146
public static
Int128
operator checked *(
Int128
left,
Int128
right)
1148
Int128
upper = BigMul(left, right, out
Int128
lower);
1176
public static
Int128
BigMul(
Int128
left,
Int128
right, out
Int128
lower)
1181
lower = (
Int128
)(ulower);
1182
return (
Int128
)(upper) - ((left >> 127) & right) - ((right >> 127) & left);
1190
public static
Int128
Clamp(
Int128
value,
Int128
min,
Int128
max)
1210
public static
Int128
CopySign(
Int128
value,
Int128
sign)
1213
Int128
signMask = (value ^ sign) >> 127;
1216
Int128
result = (value ^ signMask) - signMask;
1228
public static
Int128
Max(
Int128
x,
Int128
y) => (x >= y) ? x : y;
1231
static
Int128
INumber<
Int128
>.MaxNumber(
Int128
x,
Int128
y) => Max(x, y);
1234
public static
Int128
Min(
Int128
x,
Int128
y) => (x <= y) ? x : y;
1237
static
Int128
INumber<
Int128
>.MinNumber(
Int128
x,
Int128
y) => Min(x, y);
1240
public static int Sign(
Int128
value)
1261
public static
Int128
One => new Int128(0, 1);
1264
static int INumberBase<
Int128
>.Radix => 2;
1267
public static
Int128
Zero => default;
1270
public static
Int128
Abs(
Int128
value)
1286
public static
Int128
CreateChecked<TOther>(TOther value)
1289
Int128
result;
1291
if (typeof(TOther) == typeof(
Int128
))
1293
result = (
Int128
)(object)value;
1305
public static
Int128
CreateSaturating<TOther>(TOther value)
1308
Int128
result;
1310
if (typeof(TOther) == typeof(
Int128
))
1312
result = (
Int128
)(object)value;
1324
public static
Int128
CreateTruncating<TOther>(TOther value)
1327
Int128
result;
1329
if (typeof(TOther) == typeof(
Int128
))
1331
result = (
Int128
)(object)value;
1342
static bool INumberBase<
Int128
>.IsCanonical(
Int128
value) => true;
1345
static bool INumberBase<
Int128
>.IsComplexNumber(
Int128
value) => false;
1348
public static bool IsEvenInteger(
Int128
value) => (value._lower & 1) == 0;
1351
static bool INumberBase<
Int128
>.IsFinite(
Int128
value) => true;
1354
static bool INumberBase<
Int128
>.IsImaginaryNumber(
Int128
value) => false;
1357
static bool INumberBase<
Int128
>.IsInfinity(
Int128
value) => false;
1360
static bool INumberBase<
Int128
>.IsInteger(
Int128
value) => true;
1363
static bool INumberBase<
Int128
>.IsNaN(
Int128
value) => false;
1366
public static bool IsNegative(
Int128
value) => (long)value._upper < 0;
1369
static bool INumberBase<
Int128
>.IsNegativeInfinity(
Int128
value) => false;
1372
static bool INumberBase<
Int128
>.IsNormal(
Int128
value) => value != 0;
1375
public static bool IsOddInteger(
Int128
value) => (value._lower & 1) != 0;
1378
public static bool IsPositive(
Int128
value) => (long)value._upper >= 0;
1381
static bool INumberBase<
Int128
>.IsPositiveInfinity(
Int128
value) => false;
1384
static bool INumberBase<
Int128
>.IsRealNumber(
Int128
value) => true;
1387
static bool INumberBase<
Int128
>.IsSubnormal(
Int128
value) => false;
1390
static bool INumberBase<
Int128
>.IsZero(
Int128
value) => (value == 0);
1393
public static
Int128
MaxMagnitude(
Int128
x,
Int128
y)
1395
Int128
absX = x;
1407
Int128
absY = y;
1433
static
Int128
INumberBase<
Int128
>.MaxMagnitudeNumber(
Int128
x,
Int128
y) => MaxMagnitude(x, y);
1436
public static
Int128
MinMagnitude(
Int128
x,
Int128
y)
1438
Int128
absX = x;
1450
Int128
absY = y;
1476
static
Int128
INumberBase<
Int128
>.MinMagnitudeNumber(
Int128
x,
Int128
y) => MinMagnitude(x, y);
1479
static
Int128
INumberBase<
Int128
>.MultiplyAddEstimate(
Int128
left,
Int128
right,
Int128
addend) => (left * right) + addend;
1483
static bool INumberBase<
Int128
>.TryConvertFromChecked<TOther>(TOther value, out
Int128
result) => TryConvertFromChecked(value, out result);
1486
private static bool TryConvertFromChecked<TOther>(TOther value, out
Int128
result)
1501
result = checked((
Int128
)actualValue);
1507
result = checked((
Int128
)actualValue);
1543
result = checked((
Int128
)actualValue);
1555
static bool INumberBase<
Int128
>.TryConvertFromSaturating<TOther>(TOther value, out
Int128
result) => TryConvertFromSaturating(value, out result);
1558
private static bool TryConvertFromSaturating<TOther>(TOther value, out
Int128
result)
1573
result = (
Int128
)actualValue;
1579
result = (
Int128
)actualValue;
1615
result = (
Int128
)actualValue;
1627
static bool INumberBase<
Int128
>.TryConvertFromTruncating<TOther>(TOther value, out
Int128
result) => TryConvertFromTruncating(value, out result);
1630
private static bool TryConvertFromTruncating<TOther>(TOther value, out
Int128
result)
1645
result = (
Int128
)actualValue;
1651
result = (
Int128
)actualValue;
1687
result = (
Int128
)actualValue;
1699
static bool INumberBase<
Int128
>.TryConvertToChecked<TOther>(
Int128
value, [MaybeNullWhen(false)] out TOther result)
1767
static bool INumberBase<
Int128
>.TryConvertToSaturating<TOther>(
Int128
value, [MaybeNullWhen(false)] out TOther result)
1842
static bool INumberBase<
Int128
>.TryConvertToTruncating<TOther>(
Int128
value, [MaybeNullWhen(false)] out TOther result)
1910
public static bool TryParsePartial([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out
Int128
result, out int charsConsumed)
1917
public static bool TryParsePartial(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out
Int128
result, out int charsConsumed)
1924
public static bool TryParsePartial(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out
Int128
result, out int bytesConsumed)
1935
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out
Int128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
1942
public static
Int128
operator <<(
Int128
value, int shiftAmount)
1975
public static
Int128
operator >>(
Int128
value, int shiftAmount)
2010
public static
Int128
operator >>>(
Int128
value, int shiftAmount)
2047
public static
Int128
NegativeOne => new Int128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
2054
public static
Int128
Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
2057
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out
Int128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2064
public static
Int128
operator -(
Int128
left,
Int128
right)
2077
public static
Int128
operator checked -(
Int128
left,
Int128
right)
2084
Int128
result = left - right;
2098
public static
Int128
operator -(
Int128
value) => Zero - value;
2101
public static
Int128
operator checked -(
Int128
value) => checked(Zero - value);
2108
public static
Int128
operator +(
Int128
value) => value;
2115
public static
Int128
Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
2118
return Number.ParseBinaryInteger<byte,
Int128
>(utf8Text, style, NumberFormatInfo.GetInstance(provider));
2122
public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out
Int128
result)
2129
public static
Int128
Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider);
2132
public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out
Int128
result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result);
2138
static bool IBinaryIntegerParseAndFormatInfo<
Int128
>.IsSigned => true;
2140
static int IBinaryIntegerParseAndFormatInfo<
Int128
>.MaxDigitCount => 39; // 170_141_183_460_469_231_731_687_303_715_884_105_727
2142
static int IBinaryIntegerParseAndFormatInfo<
Int128
>.MaxHexDigitCount => 32; // 0x7FFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
2144
static
Int128
IBinaryIntegerParseAndFormatInfo<
Int128
>.MaxValueDiv10 => new Int128(0x0CCC_CCCC_CCCC_CCCC, 0xCCCC_CCCC_CCCC_CCCC);
2146
static string IBinaryIntegerParseAndFormatInfo<
Int128
>.OverflowMessage => SR.Overflow_Int128;
2148
static bool IBinaryIntegerParseAndFormatInfo<
Int128
>.IsGreaterThanAsUnsigned(
Int128
left,
Int128
right) => (UInt128)(left) > (UInt128)(right);
2150
static
Int128
IBinaryIntegerParseAndFormatInfo<
Int128
>.MultiplyBy10(
Int128
value) => value * 10;
2152
static
Int128
IBinaryIntegerParseAndFormatInfo<
Int128
>.MultiplyBy16(
Int128
value) => value * 16;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (9)
894
else if (typeof(TOther) == typeof(
Int128
))
896
Int128
actualValue = (
Int128
)(object)value;
974
else if (typeof(TOther) == typeof(
Int128
))
976
Int128
actualValue = (
Int128
)(object)value;
1059
else if (typeof(TOther) == typeof(
Int128
))
1061
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (9)
936
else if (typeof(TOther) == typeof(
Int128
))
938
Int128
actualValue = (
Int128
)(object)value;
1019
else if (typeof(TOther) == typeof(
Int128
))
1021
Int128
actualValue = (
Int128
)(object)value;
1108
else if (typeof(TOther) == typeof(
Int128
))
1110
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
54
public static
Int128
BigMul(long left, long right) => Math.BigMul(left, right);
933
else if (typeof(TOther) == typeof(
Int128
))
935
Int128
actualValue = (
Int128
)(object)value;
1015
else if (typeof(TOther) == typeof(
Int128
))
1017
Int128
actualValue = (
Int128
)(object)value;
1103
else if (typeof(TOther) == typeof(
Int128
))
1105
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (10)
190
Int128
result = long.BigMul(left, right);
958
else if (typeof(TOther) == typeof(
Int128
))
960
Int128
actualValue = (
Int128
)(object)value;
1041
else if (typeof(TOther) == typeof(
Int128
))
1043
Int128
actualValue = (
Int128
)(object)value;
1129
else if (typeof(TOther) == typeof(
Int128
))
1131
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
292
public static
Int128
BigMul(long a, long b)
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.MinMax.cs (6)
39
if (typeof(T) == typeof(
Int128
)) return MinMaxInteger<T,
Int128
, MinCalc<
Int128
>>(span);
92
if (typeof(T) == typeof(
Int128
)) return MinMaxInteger<T,
Int128
, MaxCalc<
Int128
>>(span);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (24)
1491
public static string FormatInt128(
Int128
value, string? format, IFormatProvider? provider)
1496
return
Int128
.IsPositive(value)
1503
static unsafe string FormatInt128Slow(
Int128
value, string? format, IFormatProvider? provider)
1512
return
Int128
.IsPositive(value)
1552
public static bool TryFormatInt128<TChar>(
Int128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1559
return
Int128
.IsPositive(value)
1566
static unsafe bool TryFormatInt128Slow(
Int128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1573
return
Int128
.IsPositive(value)
1636
return Int128ToHexStr((
Int128
)value, GetHexBase(fmt), digits);
1640
return UInt128ToBinaryStr((
Int128
)value, digits);
1693
return TryInt128ToHexStr((
Int128
)value, GetHexBase(fmt), digits, destination, out charsWritten);
1697
return TryUInt128ToBinaryStr((
Int128
)value, digits, destination, out charsWritten);
2585
private static unsafe void Int128ToNumber(
Int128
value, ref NumberBuffer number)
2589
if (
Int128
.IsPositive(value))
2617
public static string Int128ToDecStr(
Int128
value)
2619
return
Int128
.IsPositive(value)
2624
private static unsafe string NegativeInt128ToDecStr(
Int128
value, int digits, string sNegative)
2626
Debug.Assert(
Int128
.IsNegative(value));
2651
private static unsafe bool TryNegativeInt128ToDecStr<TChar>(
Int128
value, int digits, ReadOnlySpan<TChar> sNegative, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2654
Debug.Assert(
Int128
.IsNegative(value));
2685
private static unsafe string Int128ToHexStr(
Int128
value, char hexBase, int digits)
2704
private static unsafe bool TryInt128ToHexStr<TChar>(
Int128
value, char hexBase, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2748
private static unsafe string UInt128ToBinaryStr(
Int128
value, int digits)
2767
private static unsafe bool TryUInt128ToBinaryStr<TChar>(
Int128
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)
573
/// <summary>Explicitly converts a <see cref="
Int128
" /> value to its nearest representable <see cref="BFloat16"/> value.</summary>
576
public static explicit operator BFloat16(
Int128
value) => RoundFromSigned(value);
712
/// <summary>Explicitly converts a <see cref="BFloat16" /> value to its nearest representable <see cref="
Int128
"/>.</summary>
715
public static explicit operator
Int128
(BFloat16 value) => (
Int128
)(double)(value);
717
/// <summary>Explicitly converts a <see cref="BFloat16" /> value to its nearest representable <see cref="
Int128
"/>, throwing an overflow exception for any values that fall outside the representable range.</summary>
720
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
721
public static explicit operator checked
Int128
(BFloat16 value) => checked((
Int128
)(double)(value));
1616
else if (typeof(TOther) == typeof(
Int128
))
1618
Int128
actualValue = (
Int128
)(object)value;
1732
else if (typeof(TOther) == typeof(
Int128
))
1734
Int128
actualResult = checked((
Int128
)value);
1866
else if (typeof(TOther) == typeof(
Int128
))
1868
Int128
actualResult = ((float)value >= +170141183460469231731687303715884105727.0f) ?
Int128
.MaxValue :
1869
((float)value <= -170141183460469231731687303715884105728.0f) ?
Int128
.MinValue : (
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal128.cs (19)
400
/// <summary>Explicitly converts a <see cref="System.
Int128
" /> value to its nearest representable <see cref="System.Numerics.Decimal128" /> value.</summary>
403
public static explicit operator Decimal128(
Int128
value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128, UInt128,
Int128
>(value));
561
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal128" /> value to its nearest representable <see cref="System.
Int128
" /> value.</summary>
563
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
Int128
" /> value.</returns>
564
public static explicit operator
Int128
(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128,
Int128
>(new UInt128(value._upper, value._lower), isChecked: false);
566
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal128" /> value to its nearest representable <see cref="System.
Int128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
568
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
Int128
" /> value.</returns>
569
/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.
Int128
" />.</exception>
570
public static explicit operator checked
Int128
(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128,
Int128
>(new UInt128(value._upper, value._lower), isChecked: true);
1397
else if (typeof(TOther) == typeof(
Int128
))
1399
result = (Decimal128)(
Int128
)(object)value;
1516
else if (typeof(TOther) == typeof(
Int128
))
1518
Int128
actualResult = checked((
Int128
)value);
1639
else if (typeof(TOther) == typeof(
Int128
))
1641
result = (TOther)(object)(
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal32.cs (19)
432
/// <summary>Explicitly converts a <see cref="System.
Int128
" /> value to its nearest representable <see cref="System.Numerics.Decimal32" /> value.</summary>
435
public static explicit operator Decimal32(
Int128
value) => new Decimal32(Number.ConvertIntegerToDecimalIeee754<Decimal32, uint,
Int128
>(value));
608
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal32" /> value to its nearest representable <see cref="System.
Int128
" /> value.</summary>
610
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
Int128
" /> value.</returns>
611
public static explicit operator
Int128
(Decimal32 value) => Number.ConvertDecimalIeee754ToInteger<Decimal32, uint,
Int128
>(value._value, isChecked: false);
613
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal32" /> value to its nearest representable <see cref="System.
Int128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
615
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
Int128
" /> value.</returns>
616
/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.
Int128
" />.</exception>
617
public static explicit operator checked
Int128
(Decimal32 value) => Number.ConvertDecimalIeee754ToInteger<Decimal32, uint,
Int128
>(value._value, isChecked: true);
1420
else if (typeof(TOther) == typeof(
Int128
))
1422
result = (Decimal32)(
Int128
)(object)value;
1539
else if (typeof(TOther) == typeof(
Int128
))
1541
Int128
actualResult = checked((
Int128
)value);
1662
else if (typeof(TOther) == typeof(
Int128
))
1664
result = (TOther)(object)(
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal64.cs (19)
422
/// <summary>Explicitly converts a <see cref="System.
Int128
" /> value to its nearest representable <see cref="System.Numerics.Decimal64" /> value.</summary>
425
public static explicit operator Decimal64(
Int128
value) => new Decimal64(Number.ConvertIntegerToDecimalIeee754<Decimal64, ulong,
Int128
>(value));
593
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal64" /> value to its nearest representable <see cref="System.
Int128
" /> value.</summary>
595
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
Int128
" /> value.</returns>
596
public static explicit operator
Int128
(Decimal64 value) => Number.ConvertDecimalIeee754ToInteger<Decimal64, ulong,
Int128
>(value._value, isChecked: false);
598
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal64" /> value to its nearest representable <see cref="System.
Int128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
600
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
Int128
" /> value.</returns>
601
/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.
Int128
" />.</exception>
602
public static explicit operator checked
Int128
(Decimal64 value) => Number.ConvertDecimalIeee754ToInteger<Decimal64, ulong,
Int128
>(value._value, isChecked: true);
1411
else if (typeof(TOther) == typeof(
Int128
))
1413
result = (Decimal64)(
Int128
)(object)value;
1530
else if (typeof(TOther) == typeof(
Int128
))
1532
Int128
actualResult = checked((
Int128
)value);
1653
else if (typeof(TOther) == typeof(
Int128
))
1655
result = (TOther)(object)(
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
321
typeof(T) == typeof(
Int128
) ||
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (23)
328
/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="
Int128
" /> value.</summary>
330
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="
Int128
" /> value.</returns>
332
public static explicit operator
Int128
(NFloat value) => (
Int128
)(value._value);
334
/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="
Int128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
336
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="
Int128
" /> value.</returns>
337
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
Int128
" />.</exception>
339
public static explicit operator checked
Int128
(NFloat value) => checked((
Int128
)(value._value));
490
/// <summary>Explicitly converts a <see cref="
Int128
" /> to its nearest representable native-sized floating-point value.</summary>
494
public static explicit operator NFloat(
Int128
value)
496
if (
Int128
.IsNegative(value))
1392
else if (typeof(TOther) == typeof(
Int128
))
1394
Int128
actualValue = (
Int128
)(object)value;
1505
else if (typeof(TOther) == typeof(
Int128
))
1507
Int128
actualResult = checked((
Int128
)value);
1639
else if (typeof(TOther) == typeof(
Int128
))
1641
Int128
actualResult = (value >= +170141183460469231731687303715884105727.0) ?
Int128
.MaxValue :
1642
(value <= -170141183460469231731687303715884105728.0) ?
Int128
.MinValue : (
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SByte.cs (9)
879
else if (typeof(TOther) == typeof(
Int128
))
881
Int128
actualValue = (
Int128
)(object)value;
960
else if (typeof(TOther) == typeof(
Int128
))
962
Int128
actualValue = (
Int128
)(object)value;
1045
else if (typeof(TOther) == typeof(
Int128
))
1047
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Single.cs (3)
1307
else if (typeof(TOther) == typeof(
Int128
))
1309
Int128
actualValue = (
Int128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (6)
473
Int128
totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay)
509
Int128
totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour)
543
Int128
totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute)
575
Int128
totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond)
606
Int128
totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
613
private static TimeSpan FromMicroseconds(
Int128
microseconds)
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (16)
338
/// <summary>Explicitly converts a 128-bit unsigned integer to a <see cref="
Int128
" /> value.</summary>
340
/// <returns><paramref name="value" /> converted to a <see cref="
Int128
" />.</returns>
342
public static explicit operator
Int128
(UInt128 value) => new Int128(value._upper, value._lower);
344
/// <summary>Explicitly converts a 128-bit unsigned integer to a <see cref="
Int128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
346
/// <returns><paramref name="value" /> converted to a <see cref="
Int128
" />.</returns>
349
public static explicit operator checked
Int128
(UInt128 value)
1845
else if (typeof(TOther) == typeof(
Int128
))
1847
Int128
actualResult = checked((
Int128
)value);
1919
else if (typeof(TOther) == typeof(
Int128
))
1921
Int128
actualResult = (value >= new UInt128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ?
Int128
.MaxValue : (
Int128
)value;
1999
else if (typeof(TOther) == typeof(
Int128
))
2001
Int128
actualResult = (
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt16.cs (6)
927
else if (typeof(TOther) == typeof(
Int128
))
929
Int128
actualResult = value;
1001
else if (typeof(TOther) == typeof(
Int128
))
1003
Int128
actualResult = value;
1075
else if (typeof(TOther) == typeof(
Int128
))
1077
Int128
actualResult = value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (6)
992
else if (typeof(TOther) == typeof(
Int128
))
994
Int128
actualResult = value;
1066
else if (typeof(TOther) == typeof(
Int128
))
1068
Int128
actualResult = value;
1146
else if (typeof(TOther) == typeof(
Int128
))
1148
Int128
actualResult = value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt64.cs (8)
999
else if (typeof(TOther) == typeof(
Int128
))
1001
Int128
actualResult = checked((
Int128
)value);
1073
else if (typeof(TOther) == typeof(
Int128
))
1075
Int128
actualResult = value;
1147
else if (typeof(TOther) == typeof(
Int128
))
1149
Int128
actualResult = (
Int128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (6)
994
else if (typeof(TOther) == typeof(
Int128
))
996
Int128
actualResult = value;
1068
else if (typeof(TOther) == typeof(
Int128
))
1070
Int128
actualResult = value;
1142
else if (typeof(TOther) == typeof(
Int128
))
1144
Int128
actualResult = value;
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
281
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
Int128
))]
System.Runtime.Numerics (49)
System\Numerics\BigInteger.cs (33)
2031
return checked((decimal)(
Int128
)value);
2308
/// <summary>Explicitly converts a big integer to a <see cref="
Int128
" /> value.</summary>
2310
/// <returns><paramref name="value" /> converted to <see cref="
Int128
" /> value.</returns>
2311
public static explicit operator
Int128
(BigInteger value)
2346
Int128
ll = (value._sign > 0) ? (
Int128
)uu : -(
Int128
)uu;
2531
/// <summary>Implicitly converts a <see cref="
Int128
" /> value to a big integer.</summary>
2534
public static implicit operator BigInteger(
Int128
value)
4329
else if (typeof(TOther) == typeof(
Int128
))
4331
Int128
actualValue = (
Int128
)(object)value;
4452
else if (typeof(TOther) == typeof(
Int128
))
4454
Int128
actualValue = (
Int128
)(object)value;
4575
else if (typeof(TOther) == typeof(
Int128
))
4577
Int128
actualValue = (
Int128
)(object)value;
4694
else if (typeof(TOther) == typeof(
Int128
))
4696
Int128
actualResult = checked((
Int128
)value);
4865
else if (typeof(TOther) == typeof(
Int128
))
4867
Int128
actualResult = (value >=
Int128
.MaxValue) ?
Int128
.MaxValue :
4868
(value <=
Int128
.MinValue) ?
Int128
.MinValue : (
Int128
)value;
5107
else if (typeof(TOther) == typeof(
Int128
))
5109
Int128
actualResult;
5154
actualResult = (
Int128
)bits;
5158
actualResult = (
Int128
)(long)value._sign;
5352
actualResult = (UInt128)(
Int128
)(long)value._sign;
System\Numerics\BigIntegerCalculator.GcdInv.cs (7)
438
Int128
xCarry = 0, yCarry = 0;
441
Int128
xDigit = a * (
Int128
)x[i] - b * (
Int128
)y[i] + xCarry;
442
Int128
yDigit = d * (
Int128
)y[i] - c * (
Int128
)x[i] + yCarry;
System\Numerics\BigIntegerCalculator.SquMul.cs (7)
885
Int128
carry = 0;
889
Int128
digit = (
Int128
)(ulong)core[i] + carry - (ulong)left[i] - (ulong)right[i];
896
Int128
digit = (
Int128
)(ulong)core[i] + carry - (ulong)left[i];
903
Int128
digit = (
Int128
)(ulong)core[i] + carry;
System\Numerics\Complex.cs (2)
360
/// <summary>Explicitly converts a <see cref="
Int128
" /> value to a double-precision complex number.</summary>
363
public static explicit operator Complex(
Int128
value)
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\Int128Converter.cs (12)
12
internal sealed class Int128Converter : JsonPrimitiveConverter<
Int128
>
21
public override
Int128
Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
36
public override void Write(Utf8JsonWriter writer,
Int128
value, JsonSerializerOptions options)
47
private static unsafe
Int128
ReadCore(ref Utf8JsonReader reader)
57
if (!
Int128
.TryParse(buffer.Slice(0, written), CultureInfo.InvariantCulture, out
Int128
result))
70
private static unsafe void WriteCore(Utf8JsonWriter writer,
Int128
value)
77
internal override
Int128
ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
83
internal override unsafe void WriteAsPropertyNameCore(Utf8JsonWriter writer,
Int128
value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
90
internal override
Int128
ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options)
106
internal override unsafe void WriteNumberWithCustomHandling(Utf8JsonWriter writer,
Int128
value, JsonNumberHandling handling)
133
Int128
value, out int written)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
117
/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="
Int128
"/> values.
120
public static JsonConverter<
Int128
> Int128Converter => s_int128Converter ??= new Int128Converter();
121
private static JsonConverter<
Int128
>? s_int128Converter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
725
potentialNumberType == typeof(
Int128
) ||