44 instantiations of Int128
System.Private.CoreLib (40)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (1)
77return new Int128(
src\libraries\System.Private.CoreLib\src\System\Int128.cs (36)
474Int128 result = new Int128(value.High, value.Low64); 551Int128 result = new Int128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000); 585public static implicit operator Int128(byte value) => new Int128(0, value); 590public static implicit operator Int128(char value) => new Int128(0, value); 598return new Int128((ulong)(lower >> 63), (ulong)lower); 607return new Int128((ulong)(lower >> 63), (ulong)lower); 616return new Int128((ulong)(lower >> 63), (ulong)lower); 625return new Int128((ulong)(lower >> 63), (ulong)lower); 635return new Int128((ulong)(lower >> 63), (ulong)lower); 642public static implicit operator Int128(ushort value) => new Int128(0, value); 648public static implicit operator Int128(uint value) => new Int128(0, value); 654public static implicit operator Int128(ulong value) => new Int128(0, value); 660public static implicit operator Int128(nuint value) => new Int128(0, value); 676return new Int128(upper, lower); 967static Int128 IBinaryNumber<Int128>.AllBitsSet => new Int128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 992public static Int128 operator &(Int128 left, Int128 right) => new Int128(left._upper & right._upper, left._lower & right._lower); 995public static Int128 operator |(Int128 left, Int128 right) => new Int128(left._upper | right._upper, left._lower | right._lower); 998public static Int128 operator ^(Int128 left, Int128 right) => new Int128(left._upper ^ right._upper, left._lower ^ right._lower); 1001public static Int128 operator ~(Int128 value) => new Int128(~value._upper, ~value._lower); 1089return new Int128( 1123public static Int128 MinValue => new Int128(0x8000_0000_0000_0000, 0); 1126public static Int128 MaxValue => new Int128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1271public static Int128 One => new Int128(0, 1); 1804decimal actualResult = (value >= new Int128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue : 1805(value <= new Int128(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value; 1877decimal actualResult = (value >= new Int128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue : 1878(value <= new Int128(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value; 1945return new Int128(upper, 0); 1955return new Int128(upper, lower); 1980return new Int128(upper, lower); 1990return new Int128(upper, lower); 2013return new Int128(0, lower); 2023return new Int128(upper, lower); 2036public static Int128 NegativeOne => new Int128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 2062return new Int128(upper, lower); 2133static Int128 IBinaryIntegerParseAndFormatInfo<Int128>.MaxValueDiv10 => new Int128(0x0CCC_CCCC_CCCC_CCCC, 0xCCCC_CCCC_CCCC_CCCC);
src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
284return new Int128((ulong)high, (ulong)low);
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (2)
348public static explicit operator Int128(UInt128 value) => new Int128(value._upper, value._lower); 361return new Int128(value._upper, value._lower);
System.Runtime.Numerics (4)
System\Numerics\BigInteger.cs (4)
4723decimal actualResult = (value >= new Int128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue : 4724(value <= new Int128(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value; 4928decimal actualResult = (value >= new Int128(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? decimal.MaxValue : 4929(value <= new Int128(0xFFFF_FFFF_0000_0000, 0x0000_0000_0000_0001)) ? decimal.MinValue : (decimal)value;
682 references to Int128
Microsoft.AspNetCore.Components.Endpoints (6)
FormMapping\WellKnownConverters.cs (6)
31{ typeof(Int128), new ParsableConverter<Int128>() }, 63converters.Add(typeof(Int128?), new NullableConverter<Int128>((FormDataConverter<Int128>)converters[typeof(Int128)]));
Microsoft.AspNetCore.Components.Endpoints.Tests (6)
Binding\FormDataMapperTests.cs (6)
2113{ "-101112", typeof(Int128?), new Int128?(-(Int128)101112)}, 2155{ typeof(Int128?) }, 2198{ "-101112", typeof(Int128), -(Int128)101112 },
Microsoft.AspNetCore.Http.Extensions (6)
src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
31{ typeof(Int128), new ParsableConverter<Int128>() }, 63converters.Add(typeof(Int128?), new NullableConverter<Int128>((FormDataConverter<Int128>)converters[typeof(Int128)]));
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiConstants.cs (1)
44typeof(Int128),
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
68yield return new TestData<Int128>(42, """{"type":"integer"}"""); 1213[JsonSerializable(typeof(Int128))]
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
68yield return new TestData<Int128>(42, """{"type":"integer"}"""); 1213[JsonSerializable(typeof(Int128))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
71typeof(T) == typeof(Int128) ||
System.ComponentModel.TypeConverter (5)
System\ComponentModel\Int128Converter.cs (4)
18internal override Type TargetType => typeof(Int128); 28return Int128.Parse(value, NumberStyles.HexNumber); 35Int128.Parse(value, formatInfo); 41((Int128)value).ToString(formatInfo);
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
161[typeof(Int128)] = new IntrinsicTypeConverterData((type) => new Int128Converter()),
System.Linq (11)
System\Linq\Max.cs (4)
334if (typeof(TSource) == typeof(Int128) && comparer == Comparer<TSource>.Default) return (TSource)(object)MinMaxInteger<Int128, MaxCalc<Int128>>((IEnumerable<Int128>)source);
System\Linq\Min.cs (4)
313if (typeof(TSource) == typeof(Int128) && comparer == Comparer<TSource>.Default) return (TSource)(object)MinMaxInteger<Int128, MinCalc<Int128>>((IEnumerable<Int128>)source);
System\Linq\OrderBy.cs (1)
161t == typeof(Int128) || t == typeof(UInt128) ||
System\Linq\Sequence.cs (2)
92if (typeof(T) == typeof(long) && (range = TryUseRange<Int128>(start, endInclusive, step, long.MaxValue)) is not null) return range; 94if (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)
78typeof(T) == typeof(Int128) || typeof(T) == typeof(UInt128) ||
System.Private.CoreLib (575)
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (10)
167public static byte[] GetBytes(Int128 value) 169byte[] bytes = new byte[Int128.Size]; 181public static bool TryWriteBytes(Span<byte> destination, Int128 value) 183if (destination.Length < Int128.Size) 542public static Int128 ToInt128(byte[] value, int startIndex) 548if (startIndex > value.Length - Int128.Size) 551return Unsafe.ReadUnaligned<Int128>(ref value[startIndex]); 561public static Int128 ToInt128(ReadOnlySpan<byte> value) 563if (value.Length < Int128.Size) 565return Unsafe.ReadUnaligned<Int128>(ref MemoryMarshal.GetReference(value));
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (9)
97/// Reads a <see cref="Int128" /> from the beginning of a read-only span of bytes, as big endian. 103/// <paramref name="source"/> is too small to contain a <see cref="Int128" />. 106public static Int128 ReadInt128BigEndian(ReadOnlySpan<byte> source) 109ReverseEndianness(MemoryMarshal.Read<Int128>(source)) : 110MemoryMarshal.Read<Int128>(source); 348/// Reads a <see cref="Int128" /> from the beginning of a read-only span of bytes, as big endian. 353/// <see langword="true" /> if the span is large enough to contain a <see cref="Int128" />; otherwise, <see langword="false" />. 357public static bool TryReadInt128BigEndian(ReadOnlySpan<byte> source, out Int128 value) 361bool success = MemoryMarshal.TryRead(source, out Int128 tmp);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (9)
97/// Reads a <see cref="Int128" /> from the beginning of a read-only span of bytes, as little endian. 103/// <paramref name="source"/> is too small to contain a <see cref="Int128" />. 106public static Int128 ReadInt128LittleEndian(ReadOnlySpan<byte> source) 109ReverseEndianness(MemoryMarshal.Read<Int128>(source)) : 110MemoryMarshal.Read<Int128>(source); 348/// Reads a <see cref="Int128" /> from the beginning of a read-only span of bytes, as little endian. 353/// <see langword="true" /> if the span is large enough to contain a <see cref="Int128" />; otherwise, <see langword="false" />. 357public static bool TryReadInt128LittleEndian(ReadOnlySpan<byte> source, out Int128 value) 364bool success = MemoryMarshal.TryRead(source, out Int128 tmp);
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. 75public static Int128 ReverseEndianness(Int128 value) 376ReverseEndianness(MemoryMarshal.Cast<UInt128, Int128>(source), MemoryMarshal.Cast<UInt128, Int128>(destination)); 379public static void ReverseEndianness(ReadOnlySpan<Int128> source, Span<Int128> destination)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (8)
127/// Writes a <see cref="Int128" /> into a span of bytes, as big endian. 133/// <paramref name="destination" /> is too small to contain a <see cref="Int128" />. 136public static void WriteInt128BigEndian(Span<byte> destination, Int128 value) 140Int128 tmp = ReverseEndianness(value); 421/// Writes a <see cref="Int128" /> into a span of bytes, as big endian. 426/// <see langword="true" /> if the span is large enough to contain a <see cref="Int128" />; otherwise, <see langword="false" />. 430public static bool TryWriteInt128BigEndian(Span<byte> destination, Int128 value) 434Int128 tmp = ReverseEndianness(value);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (8)
127/// Writes a <see cref="Int128" /> into a span of bytes, as little endian. 133/// <paramref name="destination" /> is too small to contain a <see cref="Int128" />. 136public static void WriteInt128LittleEndian(Span<byte> destination, Int128 value) 140Int128 tmp = ReverseEndianness(value); 421/// Writes a <see cref="Int128" /> into a span of bytes, as little endian. 426/// <see langword="true" /> if the span is large enough to contain a <see cref="Int128" />; otherwise, <see langword="false" />. 430public static bool TryWriteInt128LittleEndian(Span<byte> destination, Int128 value) 434Int128 tmp = ReverseEndianness(value);
src\libraries\System.Private.CoreLib\src\System\Byte.cs (6)
927else if (typeof(TOther) == typeof(Int128)) 929Int128 actualResult = value; 1001else if (typeof(TOther) == typeof(Int128)) 1003Int128 actualResult = value; 1075else if (typeof(TOther) == typeof(Int128)) 1077Int128 actualResult = value;
src\libraries\System.Private.CoreLib\src\System\Char.cs (6)
1773else if (typeof(TOther) == typeof(Int128)) 1775Int128 actualResult = value; 1847else if (typeof(TOther) == typeof(Int128)) 1849Int128 actualResult = value; 1921else if (typeof(TOther) == typeof(Int128)) 1923Int128 actualResult = value;
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (6)
1681else if (typeof(TOther) == typeof(Int128)) 1683Int128 actualResult = checked((Int128)value); 1772else if (typeof(TOther) == typeof(Int128)) 1774Int128 actualResult = (Int128)value;
src\libraries\System.Private.CoreLib\src\System\Double.cs (3)
1266else if (typeof(TOther) == typeof(Int128)) 1268Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\Half.cs (10)
871/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="Int128"/>.</summary> 874public static explicit operator Int128(Half value) => (Int128)(double)(value); 876/// <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> 879/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 880public static explicit operator checked Int128(Half value) => checked((Int128)(double)(value)); 1968else if (typeof(TOther) == typeof(Int128)) 1970Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\Int128.cs (348)
18: IBinaryInteger<Int128>, 19IMinMaxValue<Int128>, 20ISignedNumber<Int128>, 22IBinaryIntegerParseAndFormatInfo<Int128> 34/// <summary>Initializes a new instance of the <see cref="Int128" /> struct.</summary> 51if (value is Int128 other) 66public int CompareTo(Int128 value) 85return (obj is Int128 other) && Equals(other); 89public bool Equals(Int128 other) 129public static Int128 Parse(string s) => Parse(s, NumberStyles.Integer, provider: null); 131public static Int128 Parse(string s, NumberStyles style) => Parse(s, style, provider: null); 133public static Int128 Parse(string s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); 135public static Int128 Parse(string s, NumberStyles style, IFormatProvider? provider) 141public static Int128 Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 144return Number.ParseBinaryInteger<char, Int128>(s, style, NumberFormatInfo.GetInstance(provider)); 147public static bool TryParse([NotNullWhen(true)] string? s, out Int128 result) => TryParse(s, NumberStyles.Integer, provider: null, out result); 149public static bool TryParse(ReadOnlySpan<char> s, out Int128 result) => TryParse(s, NumberStyles.Integer, provider: null, out result); 155public static bool TryParse(ReadOnlySpan<byte> utf8Text, out Int128 result) => TryParse(utf8Text, NumberStyles.Integer, provider: null, out result); 157public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Int128 result) 169public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out Int128 result) 182public static explicit operator byte(Int128 value) => (byte)value._lower; 187/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 188public static explicit operator checked byte(Int128 value) 200public static explicit operator char(Int128 value) => (char)value._lower; 205/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 206public static explicit operator checked char(Int128 value) 218public static explicit operator decimal(Int128 value) 231public static explicit operator double(Int128 value) 244public static explicit operator Half(Int128 value) 257public static explicit operator short(Int128 value) => (short)value._lower; 262/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 263public static explicit operator checked short(Int128 value) 276public static explicit operator int(Int128 value) => (int)value._lower; 281/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 282public static explicit operator checked int(Int128 value) 295public static explicit operator long(Int128 value) => (long)value._lower; 300/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 301public static explicit operator checked long(Int128 value) 314public static explicit operator nint(Int128 value) => (nint)value._lower; 319/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 320public static explicit operator checked nint(Int128 value) 334public static explicit operator sbyte(Int128 value) => (sbyte)value._lower; 339/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 341public static explicit operator checked sbyte(Int128 value) 354public static explicit operator float(Int128 value) 368public static explicit operator ushort(Int128 value) => (ushort)value._lower; 373/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 375public static explicit operator checked ushort(Int128 value) 388public static explicit operator uint(Int128 value) => (uint)value._lower; 393/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 395public static explicit operator checked uint(Int128 value) 408public static explicit operator ulong(Int128 value) => value._lower; 413/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 415public static explicit operator checked ulong(Int128 value) 428public static explicit operator UInt128(Int128 value) => new UInt128(value._upper, value._lower); 433/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 435public static explicit operator checked UInt128(Int128 value) 448public static explicit operator nuint(Int128 value) => (nuint)value._lower; 453/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 455public static explicit operator checked nuint(Int128 value) 471public static explicit operator Int128(decimal value) 474Int128 result = new Int128(value.High, value.Low64); 486public static explicit operator Int128(double value) 509/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 510public static explicit operator checked Int128(double value) 522internal static Int128 ToInt128(double value) 551Int128 result = new Int128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000); 570public static explicit operator Int128(float value) => (Int128)(double)(value); 575/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 576public static explicit operator checked Int128(float value) => checked((Int128)(double)(value)); 585public static implicit operator Int128(byte value) => new Int128(0, value); 590public static implicit operator Int128(char value) => new Int128(0, value); 595public static implicit operator Int128(short value) 604public static implicit operator Int128(int value) 613public static implicit operator Int128(long value) 622public static implicit operator Int128(nint value) 632public static implicit operator Int128(sbyte value) 642public static implicit operator Int128(ushort value) => new Int128(0, value); 648public static implicit operator Int128(uint value) => new Int128(0, value); 654public static implicit operator Int128(ulong value) => new Int128(0, value); 660public static implicit operator Int128(nuint value) => new Int128(0, value); 667public static Int128 operator +(Int128 left, Int128 right) 680public static Int128 operator checked +(Int128 left, Int128 right) 687Int128 result = left + right; 701static Int128 IAdditiveIdentity<Int128, Int128>.AdditiveIdentity => default; 708public static (Int128 Quotient, Int128 Remainder) DivRem(Int128 left, Int128 right) 710Int128 quotient = left / right; 715public static Int128 LeadingZeroCount(Int128 value) 720private static int LeadingZeroCountAsInt32(Int128 value) 730public static Int128 PopCount(Int128 value) 734public static Int128 RotateLeft(Int128 value, int rotateAmount) 738public static Int128 RotateRight(Int128 value, int rotateAmount) 742public static Int128 TrailingZeroCount(Int128 value) 752static bool IBinaryInteger<Int128>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out Int128 value) 754Int128 result = default; 803result = Unsafe.ReadUnaligned<Int128>(ref sourceRef); 834static bool IBinaryInteger<Int128>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out Int128 value) 836Int128 result = default; 883result = Unsafe.ReadUnaligned<Int128>(ref sourceRef); 919int IBinaryInteger<Int128>.GetShortestBitLength() 921Int128 value = this; 934int IBinaryInteger<Int128>.GetByteCount() => Size; 937bool IBinaryInteger<Int128>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten) 950bool IBinaryInteger<Int128>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten) 967static Int128 IBinaryNumber<Int128>.AllBitsSet => new Int128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 970public static bool IsPow2(Int128 value) => (PopCount(value) == 1U) && IsPositive(value); 973public static Int128 Log2(Int128 value) 992public static Int128 operator &(Int128 left, Int128 right) => new Int128(left._upper & right._upper, left._lower & right._lower); 995public static Int128 operator |(Int128 left, Int128 right) => new Int128(left._upper | right._upper, left._lower | right._lower); 998public static Int128 operator ^(Int128 left, Int128 right) => new Int128(left._upper ^ right._upper, left._lower ^ right._lower); 1001public static Int128 operator ~(Int128 value) => new Int128(~value._upper, ~value._lower); 1008public static bool operator <(Int128 left, Int128 right) 1022public static bool operator <=(Int128 left, Int128 right) 1030public static bool operator >(Int128 left, Int128 right) 1038public static bool operator >=(Int128 left, Int128 right) 1050public static Int128 operator --(Int128 value) => value - One; 1053public static Int128 operator checked --(Int128 value) => checked(value - One); 1060public static Int128 operator /(Int128 left, Int128 right) 1096public static Int128 operator checked /(Int128 left, Int128 right) => left / right; 1103public static bool operator ==(Int128 left, Int128 right) => (left._lower == right._lower) && (left._upper == right._upper); 1106public static bool operator !=(Int128 left, Int128 right) => (left._lower != right._lower) || (left._upper != right._upper); 1113public static Int128 operator ++(Int128 value) => value + One; 1116public static Int128 operator checked ++(Int128 value) => checked(value + One); 1123public static Int128 MinValue => new Int128(0x8000_0000_0000_0000, 0); 1126public static Int128 MaxValue => new Int128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 1133public static Int128 operator %(Int128 left, Int128 right) 1135Int128 quotient = left / right; 1144static Int128 IMultiplicativeIdentity<Int128, Int128>.MultiplicativeIdentity => One; 1151public static Int128 operator *(Int128 left, Int128 right) 1154return (Int128)((UInt128)(left) * (UInt128)(right)); 1158public static Int128 operator checked *(Int128 left, Int128 right) 1160Int128 upper = BigMul(left, right, out Int128 lower); 1183internal static Int128 BigMul(Int128 left, Int128 right, out Int128 lower) 1188lower = (Int128)(ulower); 1189return (Int128)(upper) - ((left >> 127) & right) - ((right >> 127) & left); 1197public static Int128 Clamp(Int128 value, Int128 min, Int128 max) 1217public static Int128 CopySign(Int128 value, Int128 sign) 1219Int128 absValue = value; 1238public static Int128 Max(Int128 x, Int128 y) => (x >= y) ? x : y; 1241static Int128 INumber<Int128>.MaxNumber(Int128 x, Int128 y) => Max(x, y); 1244public static Int128 Min(Int128 x, Int128 y) => (x <= y) ? x : y; 1247static Int128 INumber<Int128>.MinNumber(Int128 x, Int128 y) => Min(x, y); 1250public static int Sign(Int128 value) 1271public static Int128 One => new Int128(0, 1); 1274static int INumberBase<Int128>.Radix => 2; 1277public static Int128 Zero => default; 1280public static Int128 Abs(Int128 value) 1296public static Int128 CreateChecked<TOther>(TOther value) 1299Int128 result; 1301if (typeof(TOther) == typeof(Int128)) 1303result = (Int128)(object)value; 1315public static Int128 CreateSaturating<TOther>(TOther value) 1318Int128 result; 1320if (typeof(TOther) == typeof(Int128)) 1322result = (Int128)(object)value; 1334public static Int128 CreateTruncating<TOther>(TOther value) 1337Int128 result; 1339if (typeof(TOther) == typeof(Int128)) 1341result = (Int128)(object)value; 1352static bool INumberBase<Int128>.IsCanonical(Int128 value) => true; 1355static bool INumberBase<Int128>.IsComplexNumber(Int128 value) => false; 1358public static bool IsEvenInteger(Int128 value) => (value._lower & 1) == 0; 1361static bool INumberBase<Int128>.IsFinite(Int128 value) => true; 1364static bool INumberBase<Int128>.IsImaginaryNumber(Int128 value) => false; 1367static bool INumberBase<Int128>.IsInfinity(Int128 value) => false; 1370static bool INumberBase<Int128>.IsInteger(Int128 value) => true; 1373static bool INumberBase<Int128>.IsNaN(Int128 value) => false; 1376public static bool IsNegative(Int128 value) => (long)value._upper < 0; 1379static bool INumberBase<Int128>.IsNegativeInfinity(Int128 value) => false; 1382static bool INumberBase<Int128>.IsNormal(Int128 value) => value != 0; 1385public static bool IsOddInteger(Int128 value) => (value._lower & 1) != 0; 1388public static bool IsPositive(Int128 value) => (long)value._upper >= 0; 1391static bool INumberBase<Int128>.IsPositiveInfinity(Int128 value) => false; 1394static bool INumberBase<Int128>.IsRealNumber(Int128 value) => true; 1397static bool INumberBase<Int128>.IsSubnormal(Int128 value) => false; 1400static bool INumberBase<Int128>.IsZero(Int128 value) => (value == 0); 1403public static Int128 MaxMagnitude(Int128 x, Int128 y) 1405Int128 absX = x; 1417Int128 absY = y; 1443static Int128 INumberBase<Int128>.MaxMagnitudeNumber(Int128 x, Int128 y) => MaxMagnitude(x, y); 1446public static Int128 MinMagnitude(Int128 x, Int128 y) 1448Int128 absX = x; 1460Int128 absY = y; 1486static Int128 INumberBase<Int128>.MinMagnitudeNumber(Int128 x, Int128 y) => MinMagnitude(x, y); 1489static Int128 INumberBase<Int128>.MultiplyAddEstimate(Int128 left, Int128 right, Int128 addend) => (left * right) + addend; 1493static bool INumberBase<Int128>.TryConvertFromChecked<TOther>(TOther value, out Int128 result) => TryConvertFromChecked(value, out result); 1496private static bool TryConvertFromChecked<TOther>(TOther value, out Int128 result) 1511result = checked((Int128)actualValue); 1517result = checked((Int128)actualValue); 1553result = checked((Int128)actualValue); 1565static bool INumberBase<Int128>.TryConvertFromSaturating<TOther>(TOther value, out Int128 result) => TryConvertFromSaturating(value, out result); 1568private static bool TryConvertFromSaturating<TOther>(TOther value, out Int128 result) 1583result = (Int128)actualValue; 1589result = (Int128)actualValue; 1625result = (Int128)actualValue; 1637static bool INumberBase<Int128>.TryConvertFromTruncating<TOther>(TOther value, out Int128 result) => TryConvertFromTruncating(value, out result); 1640private static bool TryConvertFromTruncating<TOther>(TOther value, out Int128 result) 1655result = (Int128)actualValue; 1661result = (Int128)actualValue; 1697result = (Int128)actualValue; 1709static bool INumberBase<Int128>.TryConvertToChecked<TOther>(Int128 value, [MaybeNullWhen(false)] out TOther result) 1777static bool INumberBase<Int128>.TryConvertToSaturating<TOther>(Int128 value, [MaybeNullWhen(false)] out TOther result) 1852static bool INumberBase<Int128>.TryConvertToTruncating<TOther>(Int128 value, [MaybeNullWhen(false)] out TOther result) 1924public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Int128 result) => TryParse(s, NumberStyles.Integer, provider, out result); 1931public static Int128 operator <<(Int128 value, int shiftAmount) 1964public static Int128 operator >>(Int128 value, int shiftAmount) 1999public static Int128 operator >>>(Int128 value, int shiftAmount) 2036public static Int128 NegativeOne => new Int128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF); 2043public static Int128 Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); 2046public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Int128 result) => TryParse(s, NumberStyles.Integer, provider, out result); 2053public static Int128 operator -(Int128 left, Int128 right) 2066public static Int128 operator checked -(Int128 left, Int128 right) 2073Int128 result = left - right; 2087public static Int128 operator -(Int128 value) => Zero - value; 2090public static Int128 operator checked -(Int128 value) => checked(Zero - value); 2097public static Int128 operator +(Int128 value) => value; 2104public static Int128 Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 2107return Number.ParseBinaryInteger<byte, Int128>(utf8Text, style, NumberFormatInfo.GetInstance(provider)); 2111public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out Int128 result) 2118public static Int128 Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider); 2121public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Int128 result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result); 2127static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsSigned => true; 2129static int IBinaryIntegerParseAndFormatInfo<Int128>.MaxDigitCount => 39; // 170_141_183_460_469_231_731_687_303_715_884_105_727 2131static int IBinaryIntegerParseAndFormatInfo<Int128>.MaxHexDigitCount => 32; // 0x7FFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF 2133static Int128 IBinaryIntegerParseAndFormatInfo<Int128>.MaxValueDiv10 => new Int128(0x0CCC_CCCC_CCCC_CCCC, 0xCCCC_CCCC_CCCC_CCCC); 2135static string IBinaryIntegerParseAndFormatInfo<Int128>.OverflowMessage => SR.Overflow_Int128; 2137static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsGreaterThanAsUnsigned(Int128 left, Int128 right) => (UInt128)(left) > (UInt128)(right); 2139static Int128 IBinaryIntegerParseAndFormatInfo<Int128>.MultiplyBy10(Int128 value) => value * 10; 2141static Int128 IBinaryIntegerParseAndFormatInfo<Int128>.MultiplyBy16(Int128 value) => value * 16;
src\libraries\System.Private.CoreLib\src\System\Int16.cs (9)
913else if (typeof(TOther) == typeof(Int128)) 915Int128 actualValue = (Int128)(object)value; 989else if (typeof(TOther) == typeof(Int128)) 991Int128 actualValue = (Int128)(object)value; 1066else if (typeof(TOther) == typeof(Int128)) 1068Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\Int32.cs (9)
954else if (typeof(TOther) == typeof(Int128)) 956Int128 actualValue = (Int128)(object)value; 1037else if (typeof(TOther) == typeof(Int128)) 1039Int128 actualValue = (Int128)(object)value; 1126else if (typeof(TOther) == typeof(Int128)) 1128Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
54public static Int128 BigMul(long left, long right) => Math.BigMul(left, right); 951else if (typeof(TOther) == typeof(Int128)) 953Int128 actualValue = (Int128)(object)value; 1033else if (typeof(TOther) == typeof(Int128)) 1035Int128 actualValue = (Int128)(object)value; 1121else if (typeof(TOther) == typeof(Int128)) 1123Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (9)
952else if (typeof(TOther) == typeof(Int128)) 954Int128 actualValue = (Int128)(object)value; 1035else if (typeof(TOther) == typeof(Int128)) 1037Int128 actualValue = (Int128)(object)value; 1123else if (typeof(TOther) == typeof(Int128)) 1125Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
281public static Int128 BigMul(long a, long b)
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (24)
1101public static string FormatInt128(Int128 value, string? format, IFormatProvider? provider) 1106return Int128.IsPositive(value) 1113static unsafe string FormatInt128Slow(Int128 value, string? format, IFormatProvider? provider) 1122return Int128.IsPositive(value) 1162public static bool TryFormatInt128<TChar>(Int128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 1169return Int128.IsPositive(value) 1176static unsafe bool TryFormatInt128Slow(Int128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) 1183return Int128.IsPositive(value) 1246return Int128ToHexStr((Int128)value, GetHexBase(fmt), digits); 1250return UInt128ToBinaryStr((Int128)value, digits); 1303return TryInt128ToHexStr((Int128)value, GetHexBase(fmt), digits, destination, out charsWritten); 1307return TryUInt128ToBinaryStr((Int128)value, digits, destination, out charsWritten); 2195private static unsafe void Int128ToNumber(Int128 value, ref NumberBuffer number) 2199if (Int128.IsPositive(value)) 2227public static string Int128ToDecStr(Int128 value) 2229return Int128.IsPositive(value) 2234private static unsafe string NegativeInt128ToDecStr(Int128 value, int digits, string sNegative) 2236Debug.Assert(Int128.IsNegative(value)); 2261private static unsafe bool TryNegativeInt128ToDecStr<TChar>(Int128 value, int digits, ReadOnlySpan<TChar> sNegative, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 2264Debug.Assert(Int128.IsNegative(value)); 2295private static unsafe string Int128ToHexStr(Int128 value, char hexBase, int digits) 2314private static unsafe bool TryInt128ToHexStr<TChar>(Int128 value, char hexBase, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar> 2358private static unsafe string UInt128ToBinaryStr(Int128 value, int digits) 2377private static unsafe bool TryUInt128ToBinaryStr<TChar>(Int128 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 (23)
329/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="Int128" /> value.</summary> 331/// <returns><paramref name="value" /> converted to its nearest representable <see cref="Int128" /> value.</returns> 333public static explicit operator Int128(NFloat value) => (Int128)(value._value); 335/// <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> 337/// <returns><paramref name="value" /> converted to its nearest representable <see cref="Int128" /> value.</returns> 338/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="Int128" />.</exception> 340public static explicit operator checked Int128(NFloat value) => checked((Int128)(value._value)); 491/// <summary>Explicitly converts a <see cref="Int128" /> to its nearest representable native-sized floating-point value.</summary> 495public static explicit operator NFloat(Int128 value) 497if (Int128.IsNegative(value)) 1465else if (typeof(TOther) == typeof(Int128)) 1467Int128 actualValue = (Int128)(object)value; 1578else if (typeof(TOther) == typeof(Int128)) 1580Int128 actualResult = checked((Int128)value); 1712else if (typeof(TOther) == typeof(Int128)) 1714Int128 actualResult = (value >= +170141183460469231731687303715884105727.0) ? Int128.MaxValue : 1715(value <= -170141183460469231731687303715884105728.0) ? Int128.MinValue : (Int128)value;
src\libraries\System.Private.CoreLib\src\System\SByte.cs (9)
882else if (typeof(TOther) == typeof(Int128)) 884Int128 actualValue = (Int128)(object)value; 959else if (typeof(TOther) == typeof(Int128)) 961Int128 actualValue = (Int128)(object)value; 1036else if (typeof(TOther) == typeof(Int128)) 1038Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\Single.cs (3)
1291else if (typeof(TOther) == typeof(Int128)) 1293Int128 actualValue = (Int128)(object)value;
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (6)
479Int128 totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay) 515Int128 totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour) 549Int128 totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute) 581Int128 totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond) 612Int128 totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond) 619private static TimeSpan FromMicroseconds(Int128 microseconds)
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (16)
344/// <summary>Explicitly converts a 128-bit unsigned integer to a <see cref="Int128" /> value.</summary> 346/// <returns><paramref name="value" /> converted to a <see cref="Int128" />.</returns> 348public static explicit operator Int128(UInt128 value) => new Int128(value._upper, value._lower); 350/// <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> 352/// <returns><paramref name="value" /> converted to a <see cref="Int128" />.</returns> 355public static explicit operator checked Int128(UInt128 value) 1812else if (typeof(TOther) == typeof(Int128)) 1814Int128 actualResult = checked((Int128)value); 1886else if (typeof(TOther) == typeof(Int128)) 1888Int128 actualResult = (value >= new UInt128(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? Int128.MaxValue : (Int128)value; 1966else if (typeof(TOther) == typeof(Int128)) 1968Int128 actualResult = (Int128)value;
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (6)
946else if (typeof(TOther) == typeof(Int128)) 948Int128 actualResult = value; 1020else if (typeof(TOther) == typeof(Int128)) 1022Int128 actualResult = value; 1094else if (typeof(TOther) == typeof(Int128)) 1096Int128 actualResult = value;
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (6)
985else if (typeof(TOther) == typeof(Int128)) 987Int128 actualResult = value; 1059else if (typeof(TOther) == typeof(Int128)) 1061Int128 actualResult = value; 1139else if (typeof(TOther) == typeof(Int128)) 1141Int128 actualResult = value;
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (8)
984else if (typeof(TOther) == typeof(Int128)) 986Int128 actualResult = checked((Int128)value); 1058else if (typeof(TOther) == typeof(Int128)) 1060Int128 actualResult = value; 1132else if (typeof(TOther) == typeof(Int128)) 1134Int128 actualResult = (Int128)value;
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (6)
987else if (typeof(TOther) == typeof(Int128)) 989Int128 actualResult = value; 1061else if (typeof(TOther) == typeof(Int128)) 1063Int128 actualResult = value; 1135else if (typeof(TOther) == typeof(Int128)) 1137Int128 actualResult = value;
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
280[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Int128))]
System.Runtime.Numerics (48)
System\Numerics\BigInteger.cs (30)
1957/// <summary>Explicitly converts a big integer to a <see cref="Int128" /> value.</summary> 1959/// <returns><paramref name="value" /> converted to <see cref="Int128" /> value.</returns> 1960public static explicit operator Int128(BigInteger value) 1994Int128 ll = (value._sign > 0) ? unchecked((Int128)uu) : unchecked(-(Int128)uu); 2197/// <summary>Implicitly converts a <see cref="Int128" /> value to a big integer.</summary> 2200public static implicit operator BigInteger(Int128 value) 4269else if (typeof(TOther) == typeof(Int128)) 4271Int128 actualValue = (Int128)(object)value; 4386else if (typeof(TOther) == typeof(Int128)) 4388Int128 actualValue = (Int128)(object)value; 4503else if (typeof(TOther) == typeof(Int128)) 4505Int128 actualValue = (Int128)(object)value; 4616else if (typeof(TOther) == typeof(Int128)) 4618Int128 actualResult = checked((Int128)value); 4781else if (typeof(TOther) == typeof(Int128)) 4783Int128 actualResult = (value >= Int128.MaxValue) ? Int128.MaxValue : 4784(value <= Int128.MinValue) ? Int128.MinValue : (Int128)value; 5008else if (typeof(TOther) == typeof(Int128)) 5010Int128 actualResult; 5043actualResult = (Int128)bits;
System\Numerics\Complex.cs (18)
783/// <summary>Explicitly converts a <see cref="Int128" /> value to a double-precision complex number.</summary> 786public static explicit operator Complex(Int128 value) 1549else if (typeof(TOther) == typeof(Int128)) 1551Int128 actualValue = (Int128)(object)value; 1697else if (typeof(TOther) == typeof(Int128)) 1704Int128 actualResult = checked((Int128)value.m_real); 1878else if (typeof(TOther) == typeof(Int128)) 1880Int128 actualResult = (value.m_real >= +170141183460469231731687303715884105727.0) ? Int128.MaxValue : 1881(value.m_real <= -170141183460469231731687303715884105728.0) ? Int128.MinValue : (Int128)value.m_real; 2014else if (typeof(TOther) == typeof(Int128)) 2016Int128 actualResult = (value.m_real >= +170141183460469231731687303715884105727.0) ? Int128.MaxValue : 2017(value.m_real <= -170141183460469231731687303715884105728.0) ? Int128.MinValue : (Int128)value.m_real;
System.Text.Json (17)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
102if (type == typeof(Half) || type == typeof(UInt128) || type == typeof(Int128))
System\Text\Json\Serialization\Converters\Value\Int128Converter.cs (12)
12internal sealed class Int128Converter : JsonPrimitiveConverter<Int128> 21public override Int128 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 31public override void Write(Utf8JsonWriter writer, Int128 value, JsonSerializerOptions options) 36private static Int128 ReadCore(ref Utf8JsonReader reader) 46if (!Int128.TryParse(buffer.Slice(0, written), CultureInfo.InvariantCulture, out Int128 result)) 59private static void WriteCore(Utf8JsonWriter writer, Int128 value) 66internal override Int128 ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 72internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, Int128 value, JsonSerializerOptions options, bool isWritingExtensionDataProperty) 79internal override Int128 ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options) 90internal override void WriteNumberWithCustomHandling(Utf8JsonWriter writer, Int128 value, JsonNumberHandling handling) 114Int128 value, out int written)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
113/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="Int128"/> values. 116public static JsonConverter<Int128> Int128Converter => s_int128Converter ??= new Int128Converter(); 117private static JsonConverter<Int128>? s_int128Converter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
730potentialNumberType == typeof(Int128) ||