RFR: JDK-8299688: Adopt C++14 compatible std::bit_cast introduced in C++20 [v2]

Justin King jcking at openjdk.org
Thu Jan 5 19:59:40 UTC 2023


> Adopts a C++14 compatible implementation of [std::bit_cast](https://en.cppreference.com/w/cpp/numeric/bit_cast).
> 
> `PrimitiveConversions::cast` is refactored into `bit_cast` and extended to support all compatible types. Additionally it makes use of `__builtin_bit_cast` when available, which is strictly well defined compared to fallback approaches which are sometimes lurking in undefined behavior territory.
> 
> Lastly some legacy casting is updated to use `bit_cast` in `utilities/globalDefinitions.hpp`.

Justin King has updated the pull request incrementally with one additional commit since the last revision:

  Apple Clang thinks __builtin_bit_cast is present when its not
  
  Signed-off-by: Justin King <jcking at google.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11865/files
  - new: https://git.openjdk.org/jdk/pull/11865/files/4cff62ba..281a915e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11865&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11865&range=00-01

  Stats: 9 lines in 1 file changed: 0 ins; 0 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/11865.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11865/head:pull/11865

PR: https://git.openjdk.org/jdk/pull/11865


More information about the hotspot-dev mailing list