Remove floating point support for boost 1.58.0. As currently implemented, return by value operations are not reliable because normalization and other bit pattern changes can occur. Docs not updated as yet. Floating point support will be corrected and reinstated for boost 1.59.0, based on in-place customization and inplace and/or copy signatures to replace the unsafe (i.e. native_to_big/little ) by value returns. The big/little_to_native return by value functions are safe, but require reimplementation.

This commit is contained in:
Beman
2015-03-24 17:24:56 -04:00
parent a15f9420cb
commit 5caf1d16c8
14 changed files with 9 additions and 996 deletions
-42
View File
@@ -88,43 +88,6 @@ namespace
void little_value(uint64_t& x) {x = static_cast<uint64_t>(0xF1E2D3C444231201ULL);}
# endif
const float float_value = -1.234F;
const double double_value = -1.234567;
void native_value(float& x) {std::memcpy(&x, &float_value, sizeof(float));}
void native_value(double& x) {memcpy(&x, &double_value, sizeof(double));}
# ifdef BOOST_BIG_ENDIAN
void big_value(float& x) {memcpy(&x, &float_value, sizeof(float));}
void big_value(double& x) {memcpy(&x, &double_value, sizeof(double));}
void little_value(float& x)
{
memcpy(&x, &float_value, sizeof(float));
std::reverse(reinterpret_cast<char*>(&x),
reinterpret_cast<char*>(&x)+sizeof(float));
}
void little_value(double& x)
{
memcpy(&x, &double_value, sizeof(double));
std::reverse(reinterpret_cast<char*>(&x),
reinterpret_cast<char*>(&x)+sizeof(double));
}
# else
void big_value(float& x)
{
memcpy(&x, &float_value, sizeof(float));
std::reverse(reinterpret_cast<char*>(&x),
reinterpret_cast<char*>(&x)+sizeof(float));
}
void big_value(double& x)
{
memcpy(&x, &double_value, sizeof(double));
std::reverse(reinterpret_cast<char*>(&x),
reinterpret_cast<char*>(&x)+sizeof(double));
}
void little_value(float& x) {memcpy(&x, &float_value, sizeof(float));}
void little_value(double& x) {memcpy(&x, &double_value, sizeof(double));}
# endif
template <class T>
void test()
{
@@ -391,11 +354,6 @@ int cpp_main(int, char * [])
cout << "uint64_t" << endl;
test<uint64_t>();
cout << "float" << endl;
test<float>();
cout << "double" << endl;
test<double>();
cout << "UDT 1" << endl;
udt_test<user::UDT1>();