On Wed, 9 Oct 2024 16:17:59 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
>> @rgiulietti BTW of opening new issues, I've found that there are some >> optimizations and code simplifications that can be done in `BigInteger`'s >> bit operations that uses lowest non-zero word search, like `shiftRight()`, >> `getLowestSetBit()`, `bitLength()` and `bitCount()`. > > If you are interested, you can create new PRs without reference to JBS > issues, and I'll file them. > As usual, it's easier for review purposes when each PR touches only small > groups of strongly related changes rather than big modifications en-bloc. > > But you should show JMH benchmark evidence in later comments (not the > introductory comment) that there are no performance regressions, in addition > to code simplification. @rgiulietti I think I just found a problem much more serious than a simple optimization, I'm afraid the semantics of `BigInteger.bitCount()` is ill-defined, although it seems absurd to me that no one has noticed it so far... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21323#discussion_r1793898050