Skip to content

Commit

Permalink
Fix base1E9Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
kzrnm committed Feb 5, 2025
1 parent 177256c commit bf75784
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static void DivideAndConquer(ReadOnlySpan<uint> base1E9, int trailingZeroCount,
int powersOf1e9BufferLength = PowersOf1e9.GetBufferSize(Math.Max(valueDigits, trailingZeroCount + 1), out int maxIndex);
uint[]? powersOf1e9BufferFromPool = null;
Span<uint> powersOf1e9Buffer = (
powersOf1e9BufferLength <= BigIntegerCalculator.StackAllocThreshold
(uint)powersOf1e9BufferLength <= BigIntegerCalculator.StackAllocThreshold
? stackalloc uint[BigIntegerCalculator.StackAllocThreshold]
: powersOf1e9BufferFromPool = ArrayPool<uint>.Shared.Rent(powersOf1e9BufferLength)).Slice(0, powersOf1e9BufferLength);
powersOf1e9Buffer.Clear();
Expand Down Expand Up @@ -786,9 +786,9 @@ internal static bool TryFormatBigInteger(BigInteger value, ReadOnlySpan<char> fo

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


Expand Down

0 comments on commit bf75784

Please sign in to comment.