RFR: 8257985: count_trailing_zeros doesn't handle 64-bit values on 32-bit JVM [v2]

Claes Redestad redestad at openjdk.java.net
Fri Dec 11 13:35:10 UTC 2020


On Fri, 11 Dec 2020 12:42:52 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Yes, I misread the MSDN documentation and it appears index is undefined if there are no bits and we should rely on the return value.
>> 
>> Omitting the cast on `v >> 32` seems fine, but the comment is a bit off since `v` can be a signed type here.
>
> You are right about `v` possibly being anything, I did not look correctly. But then the new code does indeed need some cast here because the result of `something signed >> 32` is compiler dependent (at least until C++20).
> 
> Since this code path is specific to Windows (i.e. Visual Studio), it might still be true that this is the case for all platforms (ie. even ARM64), but I'd prefer the explicit cast.

Right, I think what I have works on Windows x64, but let's be explicit

-------------

PR: https://git.openjdk.java.net/jdk/pull/1747


More information about the hotspot-dev mailing list