109 instantiations of BigInteger
Microsoft.CodeAnalysis (2)
RealParser.cs (2)
62private static readonly BigInteger s_bigTwo = new BigInteger(2); 63private static readonly BigInteger s_bigTen = new BigInteger(10);
Microsoft.Gen.Logging.Generated.Tests (1)
LogPropertiesTests.cs (1)
100P10 = new BigInteger(3.1415),
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (1)
parent\parent\StaticWebAssetsSdk\Tasks\Utils\FileHasher.cs (1)
42var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan()[..9].ToArray()));
Microsoft.NET.Sdk.StaticWebAssets.Tasks (2)
ScopedCss\ComputeCssScope.cs (1)
67var dividend = BigInteger.Abs(new BigInteger([.. hash.AsSpan()[..9]]));
Utils\FileHasher.cs (1)
42var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan()[..9].ToArray()));
NuGet.Packaging (3)
Signing\DerEncoding\DerEncoder.cs (1)
1005BigInteger divisor = new BigInteger(128);
Signing\DerEncoding\DerSequenceReader.cs (2)
228BigInteger bigInt = new BigInteger(integerBytes); 301BigInteger bigInt = new BigInteger(0);
System.Formats.Asn1 (2)
System\Formats\Asn1\AsnDecoder.Integer.cs (1)
108BigInteger value = new BigInteger(contents, isBigEndian: true);
System\Formats\Asn1\AsnDecoder.Oid.cs (1)
225largeValue = new BigInteger(tmpBytes);
System.Formats.Cbor (1)
System\Formats\Cbor\CborHelpers.netcoreapp.cs (1)
16=> new BigInteger(bytes, isUnsigned: true, isBigEndian: true);
System.Runtime.Numerics (89)
System\Number.BigInteger.cs (6)
266result = new BigInteger((int)signedLeading, null); 276result = new BigInteger((int)signBits | 1, [(leading ^ signBits) - signBits]); 282result = new BigInteger(-1, [0, 1]); 332result = new BigInteger(-1, bits); 341result = new BigInteger(1, bits); 459result = new BigInteger(resultBuffer, number.IsNegative);
System\Numerics\BigInteger.cs (83)
63private static readonly BigInteger s_int32MinValue = new(-1, [UInt32HighBit]); 64private static readonly BigInteger s_one = new(1); 65private static readonly BigInteger s_zero = new(0); 66private static readonly BigInteger s_minusOne = new(-1); 888return new BigInteger((int)NumericsHelpers.Abs(value._sign), value._bits); 949return new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 990remainder = new(rest, dividend._sign < 0); 991BigInteger result = new(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 1107: new BigInteger(+1, right._bits); 1115: new BigInteger(+1, left._bits); 1165result = new BigInteger(bits, negative: false); 1272return new BigInteger(dividendBits[..limbCount], dividend._sign < 0); 1278BigInteger remainder = new(bits, dividend._sign < 0); 1373result = new BigInteger(bits, value._sign < 0 && !exponent.IsEven); 1445result = new BigInteger(genericBits, value._sign < 0 && (exponent & 1) != 0); 1522? new BigInteger((int)exactBits[0]) 1523: new BigInteger(exactBits, negative: false); 1660result = new BigInteger(bits, value._sign < 0 && (exponent & 1) != 0); 1669result = new BigInteger(bits, value._sign < 0 && (exponent & 1) != 0); 2358result = new BigInteger(bits, leftSign < 0); 2369result = new BigInteger(bits, leftSign < 0); 2380result = new BigInteger(bits, leftSign < 0); 2391result = new BigInteger(bits, leftSign < 0); 2436result = new BigInteger(bits, leftSign >= 0); 2447result = new BigInteger(bits, leftSign < 0); 2456result = new BigInteger(bits, leftSign >= 0); 2467result = new BigInteger(bits, leftSign < 0); 2502result = new BigInteger(bits, leftSign < 0); 2530result = new BigInteger(bits, compare < 0 ? leftSign >= 0 : leftSign < 0); 3007public static explicit operator BigInteger(decimal value) => new BigInteger(value); 3009public static explicit operator BigInteger(double value) => new BigInteger(value); 3014public static explicit operator BigInteger(Half value) => new BigInteger((float)value); 3019public static explicit operator BigInteger(BFloat16 value) => new BigInteger((float)value); 3034public static explicit operator BigInteger(float value) => new BigInteger(value); 3040public static implicit operator BigInteger(byte value) => new BigInteger(value); 3045public static implicit operator BigInteger(char value) => new BigInteger(value); 3047public static implicit operator BigInteger(short value) => new BigInteger(value); 3049public static implicit operator BigInteger(int value) => new BigInteger(value); 3051public static implicit operator BigInteger(long value) => new BigInteger(value); 3118return new BigInteger(sign, bits); 3124public static implicit operator BigInteger(nint value) => new BigInteger(value); 3127public static implicit operator BigInteger(sbyte value) => new BigInteger(value); 3130public static implicit operator BigInteger(ushort value) => new BigInteger(value); 3133public static implicit operator BigInteger(uint value) => new BigInteger(value); 3136public static implicit operator BigInteger(ulong value) => new BigInteger(value); 3187return new BigInteger(sign, bits); 3194public static implicit operator BigInteger(nuint value) => value <= int.MaxValue ? new BigInteger((int)value, null) : new BigInteger(+1, [value]); 3273BigInteger result = new(z); 3345return new BigInteger(value._sign, z); 3368return new BigInteger(value >= 0 ? (int)r : -(int)r, null); 3391return new BigInteger(value > 0 ? 1 : -1, rgu); 3423return new BigInteger(value._sign >> smallShift, null); 3434return new BigInteger(value._sign >> 31, null); 3455BigInteger result = new(zd, neg); 3480result = new BigInteger(bits, negative: true); 3489result = new BigInteger(bits, negative: false); 3496public static BigInteger operator -(BigInteger value) => new BigInteger(-value._sign, value._bits); 3515result = new BigInteger(bits, negative: false); 3523result = new BigInteger(bits, negative: true); 3544result = new BigInteger(bits, negative: false); 3553result = new BigInteger(bits, negative: true); 3611result = new BigInteger(bits, (leftSign < 0) ^ (rightSign < 0)); 3622result = new BigInteger(bits, (leftSign < 0) ^ (rightSign < 0)); 3631result = new BigInteger(bits, (leftSign < 0) ^ (rightSign < 0)); 3642result = new BigInteger(bits, (leftSign < 0) ^ (rightSign < 0)); 3676BigInteger result = new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 3713BigInteger result = new(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 3775BigInteger result = new(bits, dividend._sign < 0); 4062? new BigInteger((int)rs) 4063: new BigInteger(rs); 4083? new BigInteger((int)rs) 4084: new BigInteger(rs); 4277BigInteger result = new(zd, negative); 4339BigInteger result = new(zd, negative); 4378value = new BigInteger(source, isUnsigned, isBigEndian: true); 4385value = new BigInteger(source, isUnsigned, isBigEndian: false); 6030return new BigInteger((nint)value._sign >>> smallShift); 6071return new BigInteger(nint.MinValue >>> smallShift); 6076return new BigInteger(smallShift == 0 ? -1 : +1, rgu); 6119result = new BigInteger(zd, true); 6123result = new BigInteger(zd, false); 6131return new BigInteger(value._sign >> 31, null);
System.Security.Cryptography (4)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSAKeyFormatHelper.cs (1)
43x = new BigInteger(xSpan, isUnsigned: true, isBigEndian: true);
System\Security\Cryptography\X509Certificates\FindPal.cs (2)
95BigInteger hexValue = new BigInteger(hexBytes, isUnsigned: true, isBigEndian: true); 245BigInteger ten = new BigInteger(10);
System\Security\Cryptography\X509Certificates\FindPal.Windows.cs (1)
101BigInteger actualAsBigInteger = new BigInteger(actual, isUnsigned: true);
System.Security.Cryptography.Cose (1)
System\Security\Cryptography\Cose\CoseHelpers.cs (1)
183=> throw new CryptographicException(SR.Format(SR.Sign1UnknownCoseAlgorithm, BigInteger.MinusOne - new BigInteger(alg)));
System.Security.Cryptography.Pkcs (2)
System\Security\Cryptography\Pkcs\CmsSignature.cs (2)
244BigInteger val = new BigInteger( 252val = new BigInteger(
System.Security.Cryptography.Xml (1)
System\Security\Cryptography\Xml\KeyInfoX509Data.cs (1)
171h = new BigInteger(bytes);
723 references to BigInteger
Microsoft.AspNetCore.Http.Extensions (4)
src\aspnetcore\src\Shared\ParameterBindingMethodCache.cs (4)
672else if (type == typeof(BigInteger)) 674method = typeof(BigInteger).GetMethod( 675nameof(BigInteger.TryParse), 677new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider), typeof(BigInteger).MakeByRefType() });
Microsoft.AspNetCore.Mvc.Abstractions (4)
src\aspnetcore\src\Shared\ParameterBindingMethodCache.cs (4)
672else if (type == typeof(BigInteger)) 674method = typeof(BigInteger).GetMethod( 675nameof(BigInteger.TryParse), 677new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider), typeof(BigInteger).MakeByRefType() });
Microsoft.AspNetCore.OpenApi (4)
src\aspnetcore\src\Shared\ParameterBindingMethodCache.cs (4)
672else if (type == typeof(BigInteger)) 674method = typeof(BigInteger).GetMethod( 675nameof(BigInteger.TryParse), 677new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider), typeof(BigInteger).MakeByRefType() });
Microsoft.CodeAnalysis (25)
RealParser.cs (22)
60private static readonly BigInteger s_bigZero = BigInteger.Zero; 61private static readonly BigInteger s_bigOne = BigInteger.One; 62private static readonly BigInteger s_bigTwo = new BigInteger(2); 63private static readonly BigInteger s_bigTen = new BigInteger(10); 415BigInteger integerValue = AccumulateDecimalDigitsIntoBigInteger(data, integerFirstIndex, integerLastIndex); 465BigInteger fractionalNumerator = AccumulateDecimalDigitsIntoBigInteger(data, fractionalFirstIndex, fractionalLastIndex); 468BigInteger fractionalDenominator = s_bigOne; 531BigInteger fractionalRemainder; 532BigInteger bigFractionalMantissa = BigInteger.DivRem(fractionalNumerator, fractionalDenominator, out fractionalRemainder); 621private static BigInteger AccumulateDecimalDigitsIntoBigInteger(DecimalFloatingPointString data, uint integer_first_index, uint integer_last_index) 625return BigInteger.Parse(valueString); 661private static uint CountSignificantBits(BigInteger data, out byte[] dataBytes) 682private static uint CountSignificantBits(BigInteger data) 750private static void ShiftLeft(ref BigInteger number, uint shift) 752var powerOfTwo = BigInteger.Pow(s_bigTwo, (int)shift); 761private static void MultiplyByPowerOfTen(ref BigInteger number, uint power) 763var powerOfTen = BigInteger.Pow(s_bigTen, (int)power);
VersionHelper.cs (3)
118System.Numerics.BigInteger number = 0; 164System.Numerics.BigInteger number; 165if (System.Numerics.BigInteger.TryParse(s, NumberStyles.None, CultureInfo.InvariantCulture, out number))
Microsoft.Gen.Logging.Generated.Tests (1)
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesSpecialTypesExtensions.cs (1)
27public BigInteger P10 { get; set; }
Microsoft.Gen.Logging.Unit.Tests (3)
CompilationHelper.cs (1)
37refs.Add(MetadataReference.CreateFromFile(typeof(BigInteger).Assembly.Location));
EmitterTests.cs (1)
47Assembly.GetAssembly(typeof(BigInteger))!,
ParserTests.cs (1)
727Assembly.GetAssembly(typeof(BigInteger))!,
Microsoft.ML.Parquet (2)
ParquetLoader.cs (2)
517return CreateGetterDelegateCore<BigInteger, DataViewRowId>(col, _parquetConversions.Conv); 725public void Conv(in BigInteger src, ref DataViewRowId dst)
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (4)
parent\parent\StaticWebAssetsSdk\Tasks\Utils\FileHasher.cs (4)
42var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan()[..9].ToArray())); 48dividend = BigInteger.DivRem(dividend, 36, out var remainder);
Microsoft.NET.Sdk.StaticWebAssets.Tasks (8)
ScopedCss\ComputeCssScope.cs (4)
67var dividend = BigInteger.Abs(new BigInteger([.. hash.AsSpan()[..9]])); 73dividend = BigInteger.DivRem(dividend, 36, out var remainder);
Utils\FileHasher.cs (4)
42var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan()[..9].ToArray())); 48dividend = BigInteger.DivRem(dividend, 36, out var remainder);
netstandard (1)
netstandard.cs (1)
1331[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Numerics.BigInteger))]
NuGet.Packaging (12)
Signing\DerEncoding\DerEncoder.cs (10)
485BigInteger rid = ParseOidRid(oidValue, ref startPos); 966private static BigInteger ParseOidRid(string oidValue, ref int startIndex) 983BigInteger value = BigInteger.Zero; 1003private static void EncodeRid(List<byte> encodedData, ref BigInteger rid) 1005BigInteger divisor = new BigInteger(128); 1006BigInteger unencoded = rid; 1018BigInteger remainder; 1019unencoded = BigInteger.DivRem(unencoded, divisor, out remainder); 1028while (unencoded != BigInteger.Zero);
Signing\DerEncoding\DerSequenceReader.cs (2)
228BigInteger bigInt = new BigInteger(integerBytes); 301BigInteger bigInt = new BigInteger(0);
PresentationBuildTasks (3)
MS\Internal\MarkupCompiler\VersionHelper.cs (3)
114System.Numerics.BigInteger number = 0; 163System.Numerics.BigInteger number; 164if (System.Numerics.BigInteger.TryParse(s, NumberStyles.None, CultureInfo.InvariantCulture, out number))
System.Data.Common (51)
System\Data\Common\BigIntegerStorage.cs (23)
13private BigInteger[] _values = default!; // Late-initialized 16base(column, typeof(BigInteger), BigInteger.Zero, StorageType.BigInteger) 27BigInteger valueNo1 = _values[recordNo1]; 28BigInteger valueNo2 = _values[recordNo2]; 52BigInteger valueNo1 = _values[recordNo]; 58return valueNo1.CompareTo((BigInteger)value); 62internal static BigInteger ConvertToBigInteger(object value, IFormatProvider formatProvider) 64if (value.GetType() == typeof(BigInteger)) { return (BigInteger)value; } 65else if (value.GetType() == typeof(string)) { return BigInteger.Parse((string)value, formatProvider); } 74else { throw ExceptionBuilder.ConvertFailed(value.GetType(), typeof(System.Numerics.BigInteger)); } 77internal static object ConvertFromBigInteger(BigInteger value, Type type, IFormatProvider formatProvider) 91else if (type == typeof(System.Numerics.BigInteger)) { return value; } 92else { throw ExceptionBuilder.ConvertFailed(typeof(System.Numerics.BigInteger), type); } 119BigInteger value = _values[record]; 132_values[record] = BigInteger.Zero; 152return BigInteger.Parse(s, System.Globalization.CultureInfo.InvariantCulture); 159return ((BigInteger)value).ToString("D", System.Globalization.CultureInfo.InvariantCulture); 164return new BigInteger[recordCount]; 169BigInteger[] typedStore = (BigInteger[])store; 176_values = (BigInteger[])store;
System\Data\Common\DataStorage.cs (2)
92typeof(System.Numerics.BigInteger), 579dataType = typeof(System.Numerics.BigInteger);
System\Data\Common\SQLConvert.cs (3)
350if (type == typeof(System.Numerics.BigInteger)) 355else if (value is System.Numerics.BigInteger) 357return BigIntegerStorage.ConvertFromBigInteger((System.Numerics.BigInteger)value, type, formatProvider);
System\Data\DataColumn.cs (17)
262if ((BigInteger)AutoIncrementSeed != BigIntegerStorage.ConvertToBigInteger(value, FormatProvider)) 270(_autoInc ??= ((DataType == typeof(BigInteger)) ? 512if (_defaultValue is BigInteger) 514_defaultValue = BigIntegerStorage.ConvertFromBigInteger((BigInteger)_defaultValue, value, FormatProvider); 516else if (typeof(BigInteger) == value) 584AutoInc.Current = (BigInteger)(long)inc.Current; 588AutoInc.Current = checked((long)(BigInteger)inc.Current); 1608dataType == typeof(BigInteger) || 1956Debug.Assert(null != value && DataColumn.IsAutoIncrementType(value.GetType()) && !(value is BigInteger), "unexpected value for autoincrement"); 1964private bool BoundaryCheck(BigInteger value) => 1972private BigInteger _current; 1978private BigInteger _step = 1; 1984set { _current = (BigInteger)value; } 1987internal override Type DataType => typeof(BigInteger); 2037BigInteger v = (BigInteger)value; 2044private bool BoundaryCheck(BigInteger value) =>
System\Data\TypeLimiter.cs (1)
170typeof(BigInteger),
System\Data\xmlsaver.cs (5)
87else if (entry.Value is System.Numerics.BigInteger) 89v = (string)BigIntegerStorage.ConvertFromBigInteger((System.Numerics.BigInteger)entry.Value, typeof(string), CultureInfo.InvariantCulture); 199if (bIsSqlType || (col.DataType == typeof(System.Numerics.BigInteger))) 265if (type == typeof(System.Numerics.BigInteger)) 1348if ((col.IsSqlType && ((dt.Length == 0) || col.ImplementsINullable)) || (typeof(SqlXml) == col.DataType) || col.DataType == typeof(DateTimeOffset) || col.DataType == typeof(System.Numerics.BigInteger))
System.Formats.Asn1 (19)
System\Formats\Asn1\AsnDecoder.Integer.cs (6)
99public static BigInteger ReadInteger( 108BigInteger value = new BigInteger(contents, isBigEndian: true); 584public BigInteger ReadInteger(Asn1Tag? expectedTag = null) 586BigInteger ret = AsnDecoder.ReadInteger(_data.Span, RuleSet, out int consumed, expectedTag); 814public BigInteger ReadInteger(Asn1Tag? expectedTag = null) 816BigInteger ret = AsnDecoder.ReadInteger(_data, RuleSet, out int consumed, expectedTag);
System\Formats\Asn1\AsnDecoder.Oid.cs (3)
83out BigInteger? largeValue) 252ReadSubIdentifier(contents, out int bytesRead, out long? smallValue, out BigInteger? largeValue); 289BigInteger firstIdentifier = largeValue.Value;
System\Formats\Asn1\AsnWriter.Integer.cs (2)
60public void WriteInteger(BigInteger value, Asn1Tag? tag = null) 279private void WriteIntegerCore(Asn1Tag tag, BigInteger value)
System\Formats\Asn1\AsnWriter.Oid.cs (8)
116BigInteger subIdentifier = ParseSubIdentifier(ref remaining); 147private static BigInteger ParseSubIdentifier(ref ReadOnlySpan<char> oidValue) 160BigInteger value = BigInteger.Zero; 188private static int EncodeSubIdentifier(Span<byte> dest, ref BigInteger subIdentifier) 198BigInteger unencoded = subIdentifier; 203BigInteger cur = unencoded & 0x7F; 215while (unencoded != BigInteger.Zero);
System.Formats.Cbor (7)
System\Formats\Cbor\CborHelpers.netcoreapp.cs (2)
15public static BigInteger CreateBigIntegerFromUnsignedBigEndianBytes(byte[] bytes) 18public static byte[] CreateUnsignedBigEndianBytesFromBigInteger(BigInteger value)
System\Formats\Cbor\Reader\CborReader.Tag.cs (2)
153public BigInteger ReadBigInteger() 178BigInteger unsignedValue = CborHelpers.CreateBigIntegerFromUnsignedBigEndianBytes(unsignedBigEndianEncoding);
System\Formats\Cbor\Writer\CborWriter.Tag.cs (3)
88public void WriteBigInteger(BigInteger value) 91BigInteger unsignedValue = isUnsigned ? value : -1 - value; 127WriteBigInteger((BigInteger)mantissa);
System.Numerics (1)
System.Numerics.cs (1)
4[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Numerics.BigInteger))]
System.Runtime.Numerics (536)
System\Number.BigInteger.cs (32)
58internal static ParsingStatus TryParseBigInteger<TChar>(ReadOnlySpan<TChar> value, NumberStyles style, NumberFormatInfo info, out BigInteger result, out int elementsConsumed) 72internal static ParsingStatus TryParseBigIntegerPartial<TChar>(ReadOnlySpan<TChar> value, NumberStyles style, NumberFormatInfo info, out BigInteger result, out int elementsConsumed) 83private static ParsingStatus TryParseBigIntegerCore<TChar>(ReadOnlySpan<TChar> value, NumberStyles style, NumberFormatInfo info, out BigInteger result, out int elementsConsumed) 99internal static ParsingStatus TryParseBigIntegerNumber<TChar>(ReadOnlySpan<TChar> value, NumberStyles style, NumberFormatInfo info, out BigInteger result, out int elementsConsumed) 147internal static BigInteger ParseBigInteger<TChar>(ReadOnlySpan<TChar> value, NumberStyles style, NumberFormatInfo info) 155ParsingStatus status = TryParseBigIntegerCore(value, style, info, out BigInteger result, out _); 164internal static ParsingStatus TryParseBigIntegerHexOrBinaryNumberStyle<TParser, TChar>(ReadOnlySpan<TChar> value, NumberStyles style, out BigInteger result, out int elementsConsumed) 292if (totalUIntCount > BigInteger.MaxLength) 321if (bits.Length + 1 > BigInteger.MaxLength) 373private static ParsingStatus NumberToBigInteger(ref NumberBuffer number, out BigInteger result) 420base1E9 = BigInteger.RentedBuffer.Create(base1E9Length, out BigInteger.RentedBuffer base1E9Rental); 445Span<nuint> resultBuffer = BigInteger.RentedBuffer.Create(resultLength, out BigInteger.RentedBuffer resultRental); 477Span<nuint> leading = BigInteger.RentedBuffer.Create(leadingLength, out BigInteger.RentedBuffer leadingBuffer); 517scoped Span<nuint> buffer = BigInteger.RentedBuffer.Create(bufferLength, out BigInteger.RentedBuffer bufferRental); 616private static string? FormatBigIntegerToHex<TChar>(bool targetSpan, BigInteger value, char format, int digits, NumberFormatInfo info, Span<TChar> destination, out int charsWritten, out bool spanSuccess) 702private static string? FormatBigIntegerToBinary<TChar>(bool targetSpan, BigInteger value, int digits, Span<TChar> destination, out int charsWritten, out bool spanSuccess) 805internal static string FormatBigInteger(BigInteger value, string? format, NumberFormatInfo info) 810internal static bool TryFormatBigInteger<TChar>(BigInteger value, ReadOnlySpan<char> format, NumberFormatInfo info, Span<TChar> destination, out int charsWritten) 817private static string? FormatBigInteger<TChar>(bool targetSpan, BigInteger value, string? formatString, ReadOnlySpan<char> formatSpan, NumberFormatInfo info, Span<TChar> destination, out int charsWritten, out bool spanSuccess) 869Debug.Assert(BigInteger.MaxLength * digitRatio + 1 < Array.MaxLength); // won't overflow 872Span<nuint> base1E9Buffer = BigInteger.RentedBuffer.Create(base1E9BufferLength, out BigInteger.RentedBuffer base1E9Rental); 1077Span<nuint> upper = BigInteger.RentedBuffer.Create(upperLength, out BigInteger.RentedBuffer upperBuffer); 1080Span<nuint> lower = BigInteger.RentedBuffer.Create(lowerLength, out BigInteger.RentedBuffer lowerBuffer); 1484Span<nuint> powersOfTen = BigInteger.RentedBuffer.Create(bits.Length, out BigInteger.RentedBuffer powersOfTenBuffer);
System\Numerics\BigInteger.cs (413)
20IComparable<BigInteger>, 21IEquatable<BigInteger>, 22IBinaryInteger<BigInteger>, 23ISignedNumber<BigInteger>, 39/// Maximum number of limbs in a <see cref="BigInteger"/>. Restricts allocations to ~256MB, 63private static readonly BigInteger s_int32MinValue = new(-1, [UInt32HighBit]); 64private static readonly BigInteger s_one = new(1); 65private static readonly BigInteger s_zero = new(0); 66private static readonly BigInteger s_minusOne = new(-1); 693/// Initializes a new <see cref="BigInteger"/> from serialized data. 729/// Populates a <see cref="SerializationInfo"/> with the data needed to serialize the <see cref="BigInteger"/>. 769public static BigInteger Zero => s_zero; 771public static BigInteger One => s_one; 773public static BigInteger MinusOne => s_minusOne; 802public static BigInteger Parse(string value) 807public static BigInteger Parse(string value, NumberStyles style) 812public static BigInteger Parse(string value, IFormatProvider? provider) 817public static BigInteger Parse(string value, NumberStyles style, IFormatProvider? provider) 823public static bool TryParse([NotNullWhen(true)] string? value, out BigInteger result) 828public static bool TryParse([NotNullWhen(true)] string? value, NumberStyles style, IFormatProvider? provider, out BigInteger result) 833public static BigInteger Parse(ReadOnlySpan<char> value, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 838public static BigInteger Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null) 843public static bool TryParse(ReadOnlySpan<char> value, out BigInteger result) 848public static bool TryParse(ReadOnlySpan<char> value, NumberStyles style, IFormatProvider? provider, out BigInteger result) 853public static bool TryParse(ReadOnlySpan<byte> utf8Text, out BigInteger result) 858public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out BigInteger result) 864public static bool TryParsePartial([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out BigInteger result, out int charsConsumed) 870public static bool TryParsePartial(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out BigInteger result, out int bytesConsumed) 876public static bool TryParsePartial(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out BigInteger result, out int charsConsumed) 881public static int Compare(BigInteger left, BigInteger right) 886public static BigInteger Abs(BigInteger value) 891public static BigInteger Add(BigInteger left, BigInteger right) 896public static BigInteger Subtract(BigInteger left, BigInteger right) 901public static BigInteger Multiply(BigInteger left, BigInteger right) 906public static BigInteger Divide(BigInteger dividend, BigInteger divisor) 911public static BigInteger Remainder(BigInteger dividend, BigInteger divisor) 916public static BigInteger DivRem(BigInteger dividend, BigInteger divisor, out BigInteger remainder) 923BigInteger quotient; 956BigInteger quotient = DivideByPowerOfTwo(dividend, divisor, powerOfTwoExponent); 991BigInteger result = new(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 1000public static BigInteger Negate(BigInteger value) 1005public static double Log(BigInteger value) 1010public static double Log(BigInteger value, double baseValue) 1067public static double Log10(BigInteger value) 1072public static BigInteger GreatestCommonDivisor(BigInteger left, BigInteger right) 1123private static BigInteger GreatestCommonDivisor(nuint[] leftBits, nuint[] rightBits) 1136private static BigInteger GreatestCommonDivisor(ReadOnlySpan<nuint> leftBits, ReadOnlySpan<nuint> rightBits, int resultOffset) 1140BigInteger result; 1179public static BigInteger Max(BigInteger left, BigInteger right) 1184public static BigInteger Min(BigInteger left, BigInteger right) 1190private static bool TryGetPowerOfTwoExponent(BigInteger value, out int exponent) 1237private static BigInteger CreatePowerOfTwo(int exponent, bool negative) 1239BigInteger result = s_one << exponent; 1243private static BigInteger DivideByPowerOfTwo(BigInteger dividend, BigInteger divisor, int exponent) 1246BigInteger magnitude = dividend._sign < 0 ? -dividend : dividend; 1247BigInteger quotient = magnitude >> exponent; 1251private static BigInteger RemainderByPowerOfTwo(BigInteger dividend, int exponent) 1278BigInteger remainder = new(bits, dividend._sign < 0); 1302public static BigInteger ModPow(BigInteger value, BigInteger exponent, BigInteger modulus) 1338BigInteger result; 1381public static BigInteger Pow(BigInteger value, int exponent) 1409BigInteger result; 1521BigInteger exactPower = exactBits.Length == 1 && exactBits[0] <= int.MaxValue 1691return obj is BigInteger other && Equals(other); 1754public bool Equals(BigInteger other) 1826public int CompareTo(BigInteger other) 1857obj is BigInteger bigInt ? CompareTo(bigInt) : 2332private static BigInteger Add(ReadOnlySpan<nuint> leftBits, int leftSign, ReadOnlySpan<nuint> rightBits, int rightSign) 2343&& TryAddWithCommonLimbOffset(leftBits, leftSign, rightBits, out BigInteger fastResult)) 2348BigInteger result; 2398public static BigInteger operator -(BigInteger left, BigInteger right) 2410private static BigInteger Subtract(ReadOnlySpan<nuint> leftBits, int leftSign, ReadOnlySpan<nuint> rightBits, int rightSign) 2421&& TrySubtractWithCommonLimbOffset(leftBits, leftSign, rightBits, out BigInteger fastResult)) 2426BigInteger result; 2478out BigInteger result) 2511out BigInteger result) 2539public static explicit operator byte(BigInteger value) => checked((byte)((int)value)); 2544public static explicit operator char(BigInteger value) => checked((char)((int)value)); 2546public static explicit operator decimal(BigInteger value) 2556public static explicit operator double(BigInteger value) 2587private static double ConvertToDouble(BigInteger value, int precision) 2723public static explicit operator Half(BigInteger value) 2742public static explicit operator BFloat16(BigInteger value) 2764public static explicit operator short(BigInteger value) => checked((short)((int)value)); 2766public static explicit operator int(BigInteger value) 2793public static explicit operator long(BigInteger value) 2833public static explicit operator Int128(BigInteger value) 2882public static explicit operator nint(BigInteger value) => Environment.Is64BitProcess ? (nint)(long)value : (int)value; 2885public static explicit operator sbyte(BigInteger value) => checked((sbyte)((int)value)); 2887public static explicit operator float(BigInteger value) 2915public static explicit operator ushort(BigInteger value) => checked((ushort)((int)value)); 2918public static explicit operator uint(BigInteger value) 2933public static explicit operator ulong(BigInteger value) 2961public static explicit operator UInt128(BigInteger value) 3001public static explicit operator nuint(BigInteger value) => Environment.Is64BitProcess ? (nuint)(ulong)value : (uint)value; 3007public static explicit operator BigInteger(decimal value) => new BigInteger(value); 3009public static explicit operator BigInteger(double value) => new BigInteger(value); 3014public static explicit operator BigInteger(Half value) => new BigInteger((float)value); 3019public static explicit operator BigInteger(BFloat16 value) => new BigInteger((float)value); 3024public static explicit operator BigInteger(Complex value) 3031return (BigInteger)value.Real; 3034public static explicit operator BigInteger(float value) => new BigInteger(value); 3040public static implicit operator BigInteger(byte value) => new BigInteger(value); 3045public static implicit operator BigInteger(char value) => new BigInteger(value); 3047public static implicit operator BigInteger(short value) => new BigInteger(value); 3049public static implicit operator BigInteger(int value) => new BigInteger(value); 3051public static implicit operator BigInteger(long value) => new BigInteger(value); 3056public static implicit operator BigInteger(Int128 value) 3124public static implicit operator BigInteger(nint value) => new BigInteger(value); 3127public static implicit operator BigInteger(sbyte value) => new BigInteger(value); 3130public static implicit operator BigInteger(ushort value) => new BigInteger(value); 3133public static implicit operator BigInteger(uint value) => new BigInteger(value); 3136public static implicit operator BigInteger(ulong value) => new BigInteger(value); 3142public static implicit operator BigInteger(UInt128 value) 3194public static implicit operator BigInteger(nuint value) => value <= int.MaxValue ? new BigInteger((int)value, null) : new BigInteger(+1, [value]); 3196public static BigInteger operator &(BigInteger left, BigInteger right) => 3198left._bits is null && right._bits is null ? (BigInteger)(left._sign & right._sign) : 3201public static BigInteger operator |(BigInteger left, BigInteger right) 3214? (BigInteger)(left._sign | right._sign) 3218public static BigInteger operator ^(BigInteger left, BigInteger right) => 3220? (BigInteger)(left._sign ^ right._sign) 3227private static BigInteger BitwiseAnd(ref readonly BigInteger left, ref readonly BigInteger right) 3246private static BigInteger BitwiseOr(ref readonly BigInteger left, ref readonly BigInteger right) 3256private static BigInteger BitwiseXor(ref readonly BigInteger left, ref readonly BigInteger right) 3263private static BigInteger BitwiseOp<TOp>(ref readonly BigInteger left, ref readonly BigInteger right, int zLen) 3273BigInteger result = new(z); 3280public static BigInteger operator <<(BigInteger value, int shift) 3348private static BigInteger LeftShift(int value, int digitShift, int smallShift) 3394public static BigInteger operator >>(BigInteger value, int shift) 3455BigInteger result = new(zd, neg); 3462public static BigInteger operator ~(BigInteger value) 3471BigInteger result; 3496public static BigInteger operator -(BigInteger value) => new BigInteger(-value._sign, value._bits); 3498public static BigInteger operator +(BigInteger value) => value; 3500public static BigInteger operator ++(BigInteger value) 3507BigInteger result; 3530public static BigInteger operator --(BigInteger value) 3537BigInteger result; 3560public static BigInteger operator +(BigInteger left, BigInteger right) 3572public static BigInteger operator *(BigInteger left, BigInteger right) 3576return (BigInteger)((long)left._sign * right._sign); 3581BigInteger result = right << exponent; 3587BigInteger result = left << exponent; 3594private static BigInteger Multiply(ReadOnlySpan<nuint> left, int leftSign, ReadOnlySpan<nuint> right, int rightSign) 3601BigInteger result; 3649public static BigInteger operator /(BigInteger dividend, BigInteger divisor) 3676BigInteger result = new BigInteger(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 3713BigInteger result = new(quotient, (dividend._sign < 0) ^ (divisor._sign < 0)); 3721public static BigInteger operator %(BigInteger dividend, BigInteger divisor) 3775BigInteger result = new(bits, dividend._sign < 0); 3785public static bool operator <(BigInteger left, BigInteger right) => left.CompareTo(right) < 0; 3787public static bool operator <=(BigInteger left, BigInteger right) => left.CompareTo(right) <= 0; 3789public static bool operator >(BigInteger left, BigInteger right) => left.CompareTo(right) > 0; 3791public static bool operator >=(BigInteger left, BigInteger right) => left.CompareTo(right) >= 0; 3793public static bool operator ==(BigInteger left, BigInteger right) => left.Equals(right); 3795public static bool operator !=(BigInteger left, BigInteger right) => !left.Equals(right); 3797public static bool operator <(BigInteger left, long right) => left.CompareTo(right) < 0; 3799public static bool operator <=(BigInteger left, long right) => left.CompareTo(right) <= 0; 3801public static bool operator >(BigInteger left, long right) => left.CompareTo(right) > 0; 3803public static bool operator >=(BigInteger left, long right) => left.CompareTo(right) >= 0; 3805public static bool operator ==(BigInteger left, long right) => left.Equals(right); 3807public static bool operator !=(BigInteger left, long right) => !left.Equals(right); 3809public static bool operator <(long left, BigInteger right) => right.CompareTo(left) > 0; 3811public static bool operator <=(long left, BigInteger right) => right.CompareTo(left) >= 0; 3813public static bool operator >(long left, BigInteger right) => right.CompareTo(left) < 0; 3815public static bool operator >=(long left, BigInteger right) => right.CompareTo(left) <= 0; 3817public static bool operator ==(long left, BigInteger right) => right.Equals(left); 3819public static bool operator !=(long left, BigInteger right) => !right.Equals(left); 3822public static bool operator <(BigInteger left, ulong right) => left.CompareTo(right) < 0; 3825public static bool operator <=(BigInteger left, ulong right) => left.CompareTo(right) <= 0; 3828public static bool operator >(BigInteger left, ulong right) => left.CompareTo(right) > 0; 3831public static bool operator >=(BigInteger left, ulong right) => left.CompareTo(right) >= 0; 3834public static bool operator ==(BigInteger left, ulong right) => left.Equals(right); 3837public static bool operator !=(BigInteger left, ulong right) => !left.Equals(right); 3840public static bool operator <(ulong left, BigInteger right) => right.CompareTo(left) > 0; 3843public static bool operator <=(ulong left, BigInteger right) => right.CompareTo(left) >= 0; 3846public static bool operator >(ulong left, BigInteger right) => right.CompareTo(left) < 0; 3849public static bool operator >=(ulong left, BigInteger right) => right.CompareTo(left) <= 0; 3852public static bool operator ==(ulong left, BigInteger right) => right.Equals(left); 3855public static bool operator !=(ulong left, BigInteger right) => !right.Equals(left); 3928static BigInteger IAdditiveIdentity<BigInteger, BigInteger>.AdditiveIdentity => Zero; 3935static BigInteger IBinaryInteger<BigInteger>.Log10(BigInteger value) 3957BigInteger log2Value = Log2(value); 3958BigInteger approx = ((log2Value + 1) * 1292913986L) >> 32; 3959BigInteger power = Pow(10, (int)approx); 3965public static (BigInteger Quotient, BigInteger Remainder) DivRem(BigInteger left, BigInteger right) 3967BigInteger quotient = DivRem(left, right, out BigInteger remainder); 3972public static BigInteger LeadingZeroCount(BigInteger value) 3994public static BigInteger PopCount(BigInteger value) 4049public static BigInteger RotateLeft(BigInteger value, int rotateAmount) 4070public static BigInteger RotateRight(BigInteger value, int rotateAmount) 4090private static BigInteger Rotate(ReadOnlySpan<nuint> bits, bool negative, long rotateLeftAmount) 4277BigInteger result = new(zd, negative); 4302private static BigInteger RotateNuint(ReadOnlySpan<nuint> bits, bool negative, long rotateLeftAmount) 4339BigInteger result = new(zd, negative); 4347public static BigInteger TrailingZeroCount(BigInteger value) 4352private static int GetTrailingZeroCount(BigInteger value) 4376static bool IBinaryInteger<BigInteger>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out BigInteger value) 4383static bool IBinaryInteger<BigInteger>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out BigInteger value) 4390int IBinaryInteger<BigInteger>.GetShortestBitLength() 4427int IBinaryInteger<BigInteger>.GetByteCount() => GetGenericMathByteCount(); 4430bool IBinaryInteger<BigInteger>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten) 4508bool IBinaryInteger<BigInteger>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten) 4623static BigInteger IBinaryNumber<BigInteger>.AllBitsSet => MinusOne; 4626public static bool IsPow2(BigInteger value) => value.IsPowerOfTwo; 4629public static BigInteger Log2(BigInteger value) 4637? (BigInteger)((BigIntegerCalculator.BitsPerLimb - 1) ^ BitOperations.LeadingZeroCount((nuint)value._sign | 1)) 4638: (BigInteger)(((long)value._bits.Length * BigIntegerCalculator.BitsPerLimb - 1) ^ BitOperations.LeadingZeroCount(value._bits[^1])); 4646static BigInteger IMultiplicativeIdentity<BigInteger, BigInteger>.MultiplicativeIdentity => One; 4653public static BigInteger Clamp(BigInteger value, BigInteger min, BigInteger max) 4679public static BigInteger CopySign(BigInteger value, BigInteger sign) 4699static BigInteger INumber<BigInteger>.MaxNumber(BigInteger x, BigInteger y) => Max(x, y); 4702static BigInteger INumber<BigInteger>.MinNumber(BigInteger x, BigInteger y) => Min(x, y); 4705static int INumber<BigInteger>.Sign(BigInteger value) 4717static int INumberBase<BigInteger>.Radix => 2; 4721public static BigInteger CreateChecked<TOther>(TOther value) 4724BigInteger result; 4726if (typeof(TOther) == typeof(BigInteger)) 4728result = (BigInteger)(object)value; 4740public static BigInteger CreateSaturating<TOther>(TOther value) 4743BigInteger result; 4745if (typeof(TOther) == typeof(BigInteger)) 4747result = (BigInteger)(object)value; 4759public static BigInteger CreateTruncating<TOther>(TOther value) 4762BigInteger result; 4764if (typeof(TOther) == typeof(BigInteger)) 4766result = (BigInteger)(object)value; 4777static bool INumberBase<BigInteger>.IsCanonical(BigInteger value) => true; 4780static bool INumberBase<BigInteger>.IsComplexNumber(BigInteger value) => false; 4783public static bool IsEvenInteger(BigInteger value) 4791static bool INumberBase<BigInteger>.IsFinite(BigInteger value) => true; 4794static bool INumberBase<BigInteger>.IsImaginaryNumber(BigInteger value) => false; 4797static bool INumberBase<BigInteger>.IsInfinity(BigInteger value) => false; 4800static bool INumberBase<BigInteger>.IsInteger(BigInteger value) => true; 4803static bool INumberBase<BigInteger>.IsNaN(BigInteger value) => false; 4806public static bool IsNegative(BigInteger value) 4812static bool INumberBase<BigInteger>.IsNegativeInfinity(BigInteger value) => false; 4815static bool INumberBase<BigInteger>.IsNormal(BigInteger value) => (value != 0); 4818public static bool IsOddInteger(BigInteger value) 4826public static bool IsPositive(BigInteger value) 4832static bool INumberBase<BigInteger>.IsPositiveInfinity(BigInteger value) => false; 4835static bool INumberBase<BigInteger>.IsRealNumber(BigInteger value) => true; 4838static bool INumberBase<BigInteger>.IsSubnormal(BigInteger value) => false; 4841static bool INumberBase<BigInteger>.IsZero(BigInteger value) 4847public static BigInteger MaxMagnitude(BigInteger x, BigInteger y) 4854static BigInteger INumberBase<BigInteger>.MaxMagnitudeNumber(BigInteger x, BigInteger y) => MaxMagnitude(x, y); 4857public static BigInteger MinMagnitude(BigInteger x, BigInteger y) 4864static BigInteger INumberBase<BigInteger>.MinMagnitudeNumber(BigInteger x, BigInteger y) => MinMagnitude(x, y); 4867static BigInteger INumberBase<BigInteger>.MultiplyAddEstimate(BigInteger left, BigInteger right, BigInteger addend) => (left * right) + addend; 4871static bool INumberBase<BigInteger>.TryConvertFromChecked<TOther>(TOther value, out BigInteger result) => TryConvertFromChecked(value, out result); 4874private static bool TryConvertFromChecked<TOther>(TOther value, out BigInteger result) 4892result = (BigInteger)actualValue; 4898result = checked((BigInteger)actualValue); 4904result = checked((BigInteger)actualValue); 4910result = checked((BigInteger)actualValue); 4952result = checked((BigInteger)actualValue); 4994static bool INumberBase<BigInteger>.TryConvertFromSaturating<TOther>(TOther value, out BigInteger result) => TryConvertFromSaturating(value, out result); 4997private static bool TryConvertFromSaturating<TOther>(TOther value, out BigInteger result) 5015result = (BigInteger)actualValue; 5021result = double.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5027result = Half.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5033result = BFloat16.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5075result = float.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5117static bool INumberBase<BigInteger>.TryConvertFromTruncating<TOther>(TOther value, out BigInteger result) => TryConvertFromTruncating(value, out result); 5120private static bool TryConvertFromTruncating<TOther>(TOther value, out BigInteger result) 5138result = (BigInteger)actualValue; 5144result = double.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5150result = Half.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5156result = BFloat16.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5198result = float.IsNaN(actualValue) ? Zero : (BigInteger)actualValue; 5240static bool INumberBase<BigInteger>.TryConvertToChecked<TOther>(BigInteger value, [MaybeNullWhen(false)] out TOther result) 5365static bool INumberBase<BigInteger>.TryConvertToSaturating<TOther>(BigInteger value, [MaybeNullWhen(false)] out TOther result) 5564static bool INumberBase<BigInteger>.TryConvertToTruncating<TOther>(BigInteger value, [MaybeNullWhen(false)] out TOther result) 5995public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out BigInteger result) => TryParse(s, NumberStyles.Integer, provider, out result); 6002public static BigInteger operator >>>(BigInteger value, int shiftAmount) 6111BigInteger result; 6138static BigInteger ISignedNumber<BigInteger>.NegativeOne => MinusOne; 6145public static BigInteger Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); 6148public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out BigInteger result) => TryParse(s, NumberStyles.Integer, provider, out result); 6155public static BigInteger Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider); 6158public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out BigInteger result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result);
System\Numerics\BigInteger.RentedBuffer.cs (1)
14/// Provides temporary buffer management for <see cref="BigInteger"/> operations, using either stack-allocated inline storage or pooled arrays depending on size requirements.
System\Numerics\BigIntegerCalculator.DivRem.cs (28)
49Span<nuint> leftCopy = BigInteger.RentedBuffer.Create(left.Length, out BigInteger.RentedBuffer leftCopyBuffer); 79Span<nuint> quotient = BigInteger.RentedBuffer.Create(quotientLength, out BigInteger.RentedBuffer quotientBuffer); 150Span<nuint> leftCopy = BigInteger.RentedBuffer.Create( 151left.Length, out BigInteger.RentedBuffer leftCopyBuffer); 239Span<nuint> leftCopy = BigInteger.RentedBuffer.Create(left.Length, out BigInteger.RentedBuffer leftCopyBuffer); 243Span<nuint> quotientAllocated = BigInteger.RentedBuffer.Create(quotientLength, out BigInteger.RentedBuffer quotientActualBuffer); 288Span<nuint> rented = BigInteger.RentedBuffer.Create(rentedLength, out BigInteger.RentedBuffer sumBuffer); 448Span<nuint> b = BigInteger.RentedBuffer.Create(n, out BigInteger.RentedBuffer bBuffer); 461Span<nuint> a = BigInteger.RentedBuffer.Create(aLength, out BigInteger.RentedBuffer aBuffer); 497Span<nuint> r = BigInteger.RentedBuffer.Create(n + 1, out BigInteger.RentedBuffer rBuffer); 499Span<nuint> z = BigInteger.RentedBuffer.Create(2 * n, out BigInteger.RentedBuffer zBuffer); 506Span<nuint> q = BigInteger.RentedBuffer.Create(n, out BigInteger.RentedBuffer qBuffer); 613Span<nuint> r1 = BigInteger.RentedBuffer.Create(left.Length, out BigInteger.RentedBuffer r1Buffer); 653Span<nuint> r1 = BigInteger.RentedBuffer.Create(right.Length + 1, out BigInteger.RentedBuffer r1Buffer); 678Span<nuint> d = BigInteger.RentedBuffer.Create(right.Length, out BigInteger.RentedBuffer dBuffer);
System\Numerics\BigIntegerCalculator.GcdInv.cs (2)
112Span<nuint> rightCopy = BigInteger.RentedBuffer.Create(right.Length, out BigInteger.RentedBuffer rightCopyBuffer);
System\Numerics\BigIntegerCalculator.PowMod.cs (34)
25Span<nuint> temp = BigInteger.RentedBuffer.Create(bits.Length, out BigInteger.RentedBuffer tempBuffer); 27Span<nuint> valueCopy = BigInteger.RentedBuffer.Create(bits.Length, out BigInteger.RentedBuffer valueCopyBuffer); 64Span<nuint> temp = BigInteger.RentedBuffer.Create(bits.Length, out BigInteger.RentedBuffer tempBuffer); 74Span<nuint> continuationPower = BigInteger.RentedBuffer.Create( 75bits.Length, out BigInteger.RentedBuffer continuationPowerBuffer); 439Span<nuint> valueCopy = BigInteger.RentedBuffer.Create(size, out BigInteger.RentedBuffer valueCopyBuffer); 455Span<nuint> temp = BigInteger.RentedBuffer.Create(bits.Length, out BigInteger.RentedBuffer tempBuffer); 479Span<nuint> valueCopy = BigInteger.RentedBuffer.Create(size, out BigInteger.RentedBuffer valueCopyBuffer); 495Span<nuint> temp = BigInteger.RentedBuffer.Create(bits.Length, out BigInteger.RentedBuffer tempBuffer); 564Span<nuint> r = BigInteger.RentedBuffer.Create(size, out BigInteger.RentedBuffer rBuffer); 567Span<nuint> mu = BigInteger.RentedBuffer.Create(size, out BigInteger.RentedBuffer muBuffer); 570Span<nuint> q1 = BigInteger.RentedBuffer.Create(size, out BigInteger.RentedBuffer q1Buffer); 572Span<nuint> q2 = BigInteger.RentedBuffer.Create(size, out BigInteger.RentedBuffer q2Buffer); 668Span<nuint> shifted = BigInteger.RentedBuffer.Create(shiftLen, out BigInteger.RentedBuffer shiftedBuffer); 683Span<nuint> rModN = BigInteger.RentedBuffer.Create(k, out BigInteger.RentedBuffer rModNBuffer); 686Span<nuint> oneShifted = BigInteger.RentedBuffer.Create(oneShiftLen, out BigInteger.RentedBuffer oneShiftedBuffer); 735Span<nuint> prod = BigInteger.RentedBuffer.Create(bufLen, out BigInteger.RentedBuffer prodBuffer); 738Span<nuint> base2 = BigInteger.RentedBuffer.Create(k, out BigInteger.RentedBuffer base2Buffer);
System\Numerics\BigIntegerCalculator.ShiftRot.cs (4)
84Span<nuint> tmp = BigInteger.RentedBuffer.Create(tmpLength, out BigInteger.RentedBuffer tmpBuffer); 121Span<nuint> tmpNuint = BigInteger.RentedBuffer.Create(nuintCount, out BigInteger.RentedBuffer tmpBuffer);
System\Numerics\BigIntegerCalculator.SquMul.cs (12)
151Span<nuint> fold = BigInteger.RentedBuffer.Create(foldLength, out BigInteger.RentedBuffer foldBuffer); 154Span<nuint> core = BigInteger.RentedBuffer.Create(coreLength, out BigInteger.RentedBuffer coreBuffer); 523Span<nuint> leftFold = BigInteger.RentedBuffer.Create(foldLength, out BigInteger.RentedBuffer leftFoldBuffer); 525Span<nuint> rightFold = BigInteger.RentedBuffer.Create(foldLength, out BigInteger.RentedBuffer rightFoldBuffer); 534Span<nuint> core = BigInteger.RentedBuffer.Create(coreLength, out BigInteger.RentedBuffer coreBuffer); 577Span<nuint> carry = BigInteger.RentedBuffer.Create(carryLength, out BigInteger.RentedBuffer carryBuffer);
System\Numerics\Complex.cs (1)
368public static explicit operator Complex(BigInteger value)
System\Numerics\Complex.Generic.cs (9)
1797if (typeof(TOther) == typeof(BigInteger)) 1804BigInteger actualResult = checked((BigInteger)double.CreateChecked(value.m_real)); 1843if (typeof(TOther) == typeof(BigInteger)) 1845BigInteger actualResult = (BigInteger)double.CreateSaturating(value.m_real); 1874if (typeof(TOther) == typeof(BigInteger)) 1876BigInteger actualResult = (BigInteger)double.CreateTruncating(value.m_real);
System.Security.Cryptography (33)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Asn1\DssParms.xml.cs (3)
14internal System.Numerics.BigInteger P; 15internal System.Numerics.BigInteger Q; 16internal System.Numerics.BigInteger G;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSAKeyFormatHelper.cs (4)
28BigInteger x; 80BigInteger y = BigInteger.ModPow(parms.G, x, parms.P); 94BigInteger y;
System\Security\Cryptography\KeyBlobHelpers.cs (1)
40internal static byte[] ExportKeyParameter(this BigInteger value, int length)
System\Security\Cryptography\X509Certificates\Asn1\CertificationRequestInfoAsn.xml.cs (2)
15internal System.Numerics.BigInteger Version; 139internal System.Numerics.BigInteger Version;
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Build.cs (4)
111BigInteger crlNumber, 128BigInteger crlNumber, 310BigInteger crlNumber, 329BigInteger crlNumber,
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Load.cs (6)
43public static CertificateRevocationListBuilder Load(byte[] currentCrl, out BigInteger currentCrlNumber) 49out BigInteger crlNumber, 85out BigInteger currentCrlNumber, 89BigInteger crlNumber = 0; 231public static CertificateRevocationListBuilder LoadPem(string currentCrl, out BigInteger currentCrlNumber) 266public static CertificateRevocationListBuilder LoadPem(ReadOnlySpan<char> currentCrl, out BigInteger currentCrlNumber)
System\Security\Cryptography\X509Certificates\FindPal.cs (8)
95BigInteger hexValue = new BigInteger(hexBytes, isUnsigned: true, isBigEndian: true); 96BigInteger decimalValue = LaxParseDecimalBigInteger(decimalOrHexString); 243private static BigInteger LaxParseDecimalBigInteger(string decimalString) 245BigInteger ten = new BigInteger(10); 246BigInteger accum = BigInteger.Zero; 252accum = BigInteger.Multiply(accum, ten); 253accum = BigInteger.Add(accum, c - '0');
System\Security\Cryptography\X509Certificates\FindPal.Windows.cs (3)
90public unsafe void FindBySerialNumber(BigInteger hexValue, BigInteger decimalValue) 101BigInteger actualAsBigInteger = new BigInteger(actual, isUnsigned: true);
System\Security\Cryptography\X509Certificates\IFindPal.cs (2)
17void FindBySerialNumber(BigInteger hexValue, BigInteger decimalValue);
System.Security.Cryptography.Cose (1)
System\Security\Cryptography\Cose\CoseHelpers.cs (1)
183=> throw new CryptographicException(SR.Format(SR.Sign1UnknownCoseAlgorithm, BigInteger.MinusOne - new BigInteger(alg)));
System.Security.Cryptography.Pkcs (1)
System\Security\Cryptography\Pkcs\CmsSignature.cs (1)
244BigInteger val = new BigInteger(
System.Security.Cryptography.Xml (3)
System\Security\Cryptography\Xml\KeyInfoX509Data.cs (3)
161BigInteger h; 162if (!BigInteger.TryParse(serialNumber, NumberStyles.AllowHexSpecifier, NumberFormatInfo.CurrentInfo, out h)) 167if (h < BigInteger.Zero)