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

Claes Redestad redestad at openjdk.java.net
Fri Dec 11 14:03:09 UTC 2020


> Re-implement count_trailing_zeros as a template function similar to count_leading_zeros, adding support for 8 and 16 bit types as well as for 64-bit types on 32-bit builds, which is currently not supported. This prohibits implementing the log2i_exact proposed by #1663 using count_trailing_zeros, as suggested during review.
> 
> Compared to count_leading_zeros the implementation can be slightly simpler since subword specializations can simply use the internal 32-bit variant.
> 
> Windows doesn't define _BitScanForward64 on 32-bit targets, so the 32-bit variant for handling 64-bit values becomes more convoluted.

Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:

  Simplify based on @kimbarrett review comments pt 2

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1747/files
  - new: https://git.openjdk.java.net/jdk/pull/1747/files/c16f9b05..9b613682

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1747&range=05
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1747&range=04-05

  Stats: 21 lines in 1 file changed: 11 ins; 10 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1747.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1747/head:pull/1747

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


More information about the hotspot-dev mailing list