Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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? ContributorAuthor 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, | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -274,6 +274,18 @@ public static void ModPowAxiom() | ||
| } | ||
| } | ||
| [Fact] | ||
| public static void RegressionIssue70330() | ||
| { | ||
| byte[] tempByteArray1 = { 226, 32 }; | ||
| byte[] tempByteArray2 = { 113 }; | ||
| byte[] tempByteArray3 = { 15, 8, 201, 158, 96, 200, 233, 243, 184, 0, 33, 203, 210, 80, 174, 198, 244, 177, 223, 221, 168, 243, 233, 133, 103, 252, 219, 195, 187, 227, 215, 54, 66, 248, 37, 186, 232, 45, 227, 147, 100, 14, 121, 244, 56, 89, 181, 120, 205, 4, 59, 48, 65, 239, 221, 28, 30, 68, 55, 99, 237, 38, 56, 213, 40, 234, 136, 218, 42, 244, 222, 198, 205 }; | ||
| VerifyIdentityString( | ||
| Print(tempByteArray3) + Print(tempByteArray2) + Print(tempByteArray1) + "tModPow", | ||
| Print(tempByteArray3) + Print(tempByteArray2) + Print(tempByteArray1) + "bPow" + " bRemainder" | ||
| ); | ||
dakersnar marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| [Fact] | ||
| public static void ModPowBoundary() | ||
| { | ||
Uh oh!
There was an error while loading. Please reload this page.