htpiv/use-bit-cast
main
1. memcpy is declared in <cstring>; make sure to include it if needed 2. asFloat's __cpp_lib_bit_cast was using the wrong name for its parameter (the param was renamed after testing and I never rebuilt) with `__cpp_lib_bit_cast` on. Oops :-(
C++ does not, pedantically, allow the use of unions for type-punning in the way that C does. Most compilers, in practice, do support it; however, recent versions of MSVC appear to have a bug that cause bad code to be generated due to this U.B. (see: https://developercommunity.visualstudio.com/t/Bad-code-generated-for-std::isnan-compil/10082631). This led to a series of issues in the react-native-windows project, see: * https://github.com/microsoft/react-native-windows/issues/4122 * https://github.com/microsoft/react-native-windows/issues/8675 In C++20, the `<bit>` header and `bit_cast` function provide a pleasant API for type-punning. Since C++20 is not universally available, if the feature-test macro for `bit_cast` is not defined, memcpy is used instead.