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

Justin King jcking at openjdk.org
Fri Jan 13 16:19:51 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:

  Remove addressof as nobody should be overloading operator&
  
  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/e5921255..ccb8f280

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

  Stats: 24 lines in 2 files changed: 0 ins; 20 del; 4 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