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

Justin King jcking at openjdk.org
Mon Jan 23 17:32:00 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 two additional commits since the last revision:

 - ALWAYSINLINE
   
   Signed-off-by: Justin King <jcking at google.com>
 - Fix pointer casts
   
   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/b9fed0f2..9f245c9d

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

  Stats: 13 lines in 1 file changed: 1 ins; 0 del; 12 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