-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix for Random failures in System.Numerics.Tests.modpowTest.ModPowAxiom test #74112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -217,7 +217,11 @@ public static void Pow(ReadOnlySpan<uint> value, uint power, | |
| Span<uint> valueCopy = (size <= StackAllocThreshold ? | ||
| stackalloc uint[StackAllocThreshold] | ||
| : valueCopyFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); | ||
| valueCopy.Clear(); | ||
|
|
||
| // smallish optimization here: | ||
| // subsequent operations will copy the elements to the beginning of the buffer, | ||
| // no need to clear everything | ||
| valueCopy.Slice(value.Length).Clear(); | ||
|
|
||
| if (value.Length > modulus.Length) | ||
| { | ||
|
|
@@ -262,7 +266,11 @@ public static void Pow(ReadOnlySpan<uint> value, ReadOnlySpan<uint> power, | |
| Span<uint> valueCopy = (size <= StackAllocThreshold ? | ||
| stackalloc uint[StackAllocThreshold] | ||
| : valueCopyFromPool = ArrayPool<uint>.Shared.Rent(size)).Slice(0, size); | ||
| valueCopy.Clear(); | ||
|
|
||
| // smallish optimization here: | ||
| // subsequent operations will copy the elements to the beginning of the buffer, | ||
| // no need to clear everything | ||
| valueCopy.Slice(value.Length).Clear(); | ||
|
|
||
| if (value.Length > modulus.Length) | ||
| { | ||
|
|
@@ -464,7 +472,7 @@ private static Span<uint> PowCore(Span<uint> value, int valueLength, | |
| power >>= 1; | ||
| } | ||
|
|
||
| return result.Slice(0, resultLength); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this slice basically unnecessary in all cases, and causing problems in this edge case?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, correct. It doesn't exist for overload of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this slice introduced a regression for the case of:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this scenario, the length of I expect the actual issue here is that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its not that |
||
| return result; | ||
| } | ||
|
|
||
| private static Span<uint> PowCore(Span<uint> value, int valueLength, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.