On Sun, 11 May 2025 16:12:38 GMT, fabioromano1 <d...@openjdk.org> wrote:
>>> This should really be refactored to an instance method `bitLengthUnsigned` >>> or `magBitCount` >> >> I would prefer `magBitLength` as a name, since `bitCount` is usually >> referred to one's bit count. But before do this, I'd hear the opinion of >> @rgiulietti about that. > >> Making this an instance method makes code cleaner and allows us to cache if >> we find this calculation expensive. > > I recall that `bitLength` is already cached, so it would be preferable to > replace `bitLength`'s cache with `magBitLength`'s cache if we want to do so. > the `len` is always `val.length` and the `val` is always the `mag` array of > some `BigInteger` from somewhere. Yes, but making it an instance method could be too narrowing, as sometimes in the code `int[]` array local variables are used in preference of `mag` instance fields. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25166#discussion_r2083567353