// Test for boost/core/bit.hpp (bit_cast) // // Copyright 2020 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include int main() { { float x = 0.89f; boost::uint32_t y = boost::core::bit_cast( x ); BOOST_TEST( std::memcmp( &x, &y, sizeof(x) ) == 0 ); } { double x = 0.89; boost::uint64_t y = boost::core::bit_cast( x ); BOOST_TEST( std::memcmp( &x, &y, sizeof(x) ) == 0 ); } return boost::report_errors(); }