Optimize shift operations for BigInteger#112632
Conversation
|
|
||
| // Do an in-place one's complement. "Dangerous" because it causes | ||
| // a mutation and needs to be used with care for immutable types. | ||
| public static void DangerousMakeOnesComplement(Span<uint> d) |
There was a problem hiding this comment.
If it accepts a non-readonly span - what is dangerous with it? We typically name such things with "Inplace"
There was a problem hiding this comment.
I followed the existing DangerousMakeTwosComplement. I have no strong preference for the naming convention, but if DangerousMakeOnesComplement is to be renamed, then DangerousMakeTwosComplement should be renamed as well.
There was a problem hiding this comment.
np. It just that it's the code that converts an immutable data into mutable span is what actually dangerous 🙂
This is indeed behavioral change, could require design decision and breaking change announcement. |
2f4e87a to
f0733dd
Compare
|
I noticed other compatibility-related problem, so I will esubmit new PR. |
I'd suggest to confirm the proposed behavioral change in the issue first. |
Fix #112564
This pull request includes the following changes:
RotateLeft,RotateRightand the unsigned right shift(>>>).>>>) of BigInteger behaves strangely #112564)Benchmark
benchmark code