Skip to content

Commit

Permalink
BigInteger parsing optimizations (#47842)
Browse files Browse the repository at this point in the history
* Optimize BigInteger parsing

* Use ArrayPool<int> instead of ArrayPool<uint>.

* Additional changes

* Additional changes
  • Loading branch information
jfd16 authored May 9, 2021
1 parent 3297e7e commit b3278ca
Show file tree
Hide file tree
Showing 2 changed files with 279 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public BigInteger(ReadOnlySpan<byte> value, bool isUnsigned = false, bool isBigE
AssertValid();
}

private BigInteger(int n, uint[]? rgu)
internal BigInteger(int n, uint[]? rgu)
{
_sign = n;
_bits = rgu;
Expand Down Expand Up @@ -703,7 +703,7 @@ public static BigInteger Parse(ReadOnlySpan<char> value, NumberStyles style = Nu

public static bool TryParse(ReadOnlySpan<char> value, out BigInteger result)
{
return BigNumber.TryParseBigInteger(value, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);
return TryParse(value, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);
}

public static bool TryParse(ReadOnlySpan<char> value, NumberStyles style, IFormatProvider? provider, out BigInteger result)
Expand Down
Loading

0 comments on commit b3278ca

Please sign in to comment.