Skip to content

Commit bf75784

Browse files
committed
Fix base1E9Buffer
1 parent 177256c commit bf75784

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libraries/System.Runtime.Numerics/src/System/Number.BigInteger.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static void DivideAndConquer(ReadOnlySpan<uint> base1E9, int trailingZeroCount,
406406
int powersOf1e9BufferLength = PowersOf1e9.GetBufferSize(Math.Max(valueDigits, trailingZeroCount + 1), out int maxIndex);
407407
uint[]? powersOf1e9BufferFromPool = null;
408408
Span<uint> powersOf1e9Buffer = (
409-
powersOf1e9BufferLength <= BigIntegerCalculator.StackAllocThreshold
409+
(uint)powersOf1e9BufferLength <= BigIntegerCalculator.StackAllocThreshold
410410
? stackalloc uint[BigIntegerCalculator.StackAllocThreshold]
411411
: powersOf1e9BufferFromPool = ArrayPool<uint>.Shared.Rent(powersOf1e9BufferLength)).Slice(0, powersOf1e9BufferLength);
412412
powersOf1e9Buffer.Clear();
@@ -786,9 +786,9 @@ internal static bool TryFormatBigInteger(BigInteger value, ReadOnlySpan<char> fo
786786

787787
int base1E9BufferLength = (int)(value._bits.Length * digitRatio) + 1;
788788
uint[]? base1E9BufferFromPool = null;
789-
Span<uint> base1E9Buffer = base1E9BufferLength < BigIntegerCalculator.StackAllocThreshold ?
789+
Span<uint> base1E9Buffer = ((uint)base1E9BufferLength <= BigIntegerCalculator.StackAllocThreshold ?
790790
stackalloc uint[base1E9BufferLength] :
791-
(base1E9BufferFromPool = ArrayPool<uint>.Shared.Rent(base1E9BufferLength));
791+
(base1E9BufferFromPool = ArrayPool<uint>.Shared.Rent(base1E9BufferLength))).Slice(0, base1E9BufferLength);
792792
base1E9Buffer.Clear();
793793

794794

0 commit comments

Comments
 (0)