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
-100
View File
@@ -79,22 +79,6 @@ namespace endian
BOOST_SCOPED_ENUM(align) A = align::no>
class endian_arithmetic;
// big endian floating point aligned types
typedef endian_arithmetic<order::big, float, 32, align::yes> big_float32_at;
typedef endian_arithmetic<order::big, double, 64, align::yes> big_float64_at;
// little endian floating point aligned types
typedef endian_arithmetic<order::little, float, 32, align::yes> little_float32_at;
typedef endian_arithmetic<order::little, double, 64, align::yes> little_float64_at;
// big endian floating point unaligned types
typedef endian_arithmetic<order::big, float, 32, align::no> big_float32_t;
typedef endian_arithmetic<order::big, double, 64, align::no> big_float64_t;
// little endian floating point unaligned types
typedef endian_arithmetic<order::little, float, 32, align::no> little_float32_t;
typedef endian_arithmetic<order::little, double, 64, align::no> little_float64_t;
// big endian signed integer aligned types
typedef endian_arithmetic<order::big, int8_t, 8, align::yes> big_int8_at;
typedef endian_arithmetic<order::big, int16_t, 16, align::yes> big_int16_at;
@@ -182,12 +166,6 @@ namespace endian
typedef big_uint48_t native_uint48_t;
typedef big_uint56_t native_uint56_t;
typedef big_uint64_t native_uint64_t;
// native endian floating point types
typedef big_float32_t native_float32_t;
typedef big_float64_t native_float64_t;
typedef big_float32_at native_float32_at;
typedef big_float64_at native_float64_at;
# else
// native endian signed integer unaligned types
typedef little_int8_t native_int8_t;
@@ -208,12 +186,6 @@ namespace endian
typedef little_uint48_t native_uint48_t;
typedef little_uint56_t native_uint56_t;
typedef little_uint64_t native_uint64_t;
// native endian floating point types
typedef little_float32_t native_float32_t;
typedef little_float64_t native_float64_t;
typedef little_float32_at native_float32_at;
typedef little_float64_at native_float64_at;
# endif
# ifdef BOOST_ENDIAN_DEPRECATED_NAMES
@@ -340,78 +312,6 @@ namespace endian
{ detail::store_big_endian<T, n_bits/8>(this->m_value, val); return *this; }
operator value_type() const BOOST_NOEXCEPT { return this->value(); }
};
// unaligned float big endian specialization
template <>
class endian_arithmetic< order::big, float, 32, align::no >
: public endian_buffer< order::big, float, 32, align::no >,
cover_operators< endian_arithmetic< order::big, float, 32 >, float >
{
public:
typedef float value_type;
# ifndef BOOST_ENDIAN_NO_CTORS
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(value_type val) BOOST_NOEXCEPT
{ detail::big_reverse_copy(val, this->m_value); }
# endif
endian_arithmetic& operator=(value_type val) BOOST_NOEXCEPT
{ detail::big_reverse_copy(val, this->m_value); return *this; }
operator value_type() const BOOST_NOEXCEPT { return this->value(); }
};
// unaligned double big endian specialization
template <>
class endian_arithmetic< order::big, double, 64, align::no >
: public endian_buffer< order::big, double, 64, align::no >,
cover_operators< endian_arithmetic< order::big, double, 64 >, double >
{
public:
typedef double value_type;
# ifndef BOOST_ENDIAN_NO_CTORS
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(value_type val) BOOST_NOEXCEPT
{ detail::big_reverse_copy(val, this->m_value); }
# endif
endian_arithmetic& operator=(value_type val) BOOST_NOEXCEPT
{ detail::big_reverse_copy(val, this->m_value); return *this; }
operator value_type() const BOOST_NOEXCEPT { return this->value(); }
};
// unaligned float little endian specialization
template <>
class endian_arithmetic< order::little, float, 32, align::no >
: public endian_buffer< order::little, float, 32, align::no >,
cover_operators< endian_arithmetic< order::little, float, 32 >, float >
{
public:
typedef float value_type;
# ifndef BOOST_ENDIAN_NO_CTORS
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(value_type val) BOOST_NOEXCEPT
{ detail::little_reverse_copy(val, this->m_value); }
# endif
endian_arithmetic& operator=(value_type val) BOOST_NOEXCEPT
{ detail::little_reverse_copy(val, this->m_value); return *this; }
operator value_type() const BOOST_NOEXCEPT { return this->value(); }
};
// unaligned double little endian specialization
template <>
class endian_arithmetic< order::little, double, 64, align::no >
: public endian_buffer< order::little, double, 64, align::no >,
cover_operators< endian_arithmetic< order::little, double, 64 >, double >
{
public:
typedef double value_type;
# ifndef BOOST_ENDIAN_NO_CTORS
endian_arithmetic() BOOST_ENDIAN_DEFAULT_CONSTRUCT
BOOST_ENDIAN_EXPLICIT_OPT endian_arithmetic(value_type val) BOOST_NOEXCEPT
{ detail::little_reverse_copy(val, this->m_value); }
# endif
endian_arithmetic& operator=(value_type val) BOOST_NOEXCEPT
{ detail::little_reverse_copy(val, this->m_value); return *this; }
operator value_type() const BOOST_NOEXCEPT { return this->value(); }
};
// unaligned little endian specialization
template <typename T, std::size_t n_bits>
-28
View File
@@ -76,22 +76,6 @@ namespace endian
BOOST_SCOPED_ENUM(align) A = align::no>
class endian_buffer;
// aligned big endian floating point buffers
typedef endian_buffer<order::big, float, 32, align::yes> big_float32_buf_at;
typedef endian_buffer<order::big, double, 64, align::yes> big_float64_buf_at;
// aligned little endian floating point buffers
typedef endian_buffer<order::little, float, 32, align::yes> little_float32_buf_at;
typedef endian_buffer<order::little, double, 64, align::yes> little_float64_buf_at;
// unaligned big endian floating point buffers
typedef endian_buffer<order::big, float, 32, align::no> big_float32_buf_t;
typedef endian_buffer<order::big, double, 64, align::no> big_float64_buf_t;
// unaligned little endian floating point buffers
typedef endian_buffer<order::little, float, 32, align::no> little_float32_buf_t;
typedef endian_buffer<order::little, double, 64, align::no> little_float64_buf_t;
// aligned big endian signed integer buffers
typedef endian_buffer<order::big, int8_t, 8, align::yes> big_int8_buf_at;
typedef endian_buffer<order::big, int16_t, 16, align::yes> big_int16_buf_at;
@@ -179,12 +163,6 @@ namespace endian
typedef big_uint48_buf_t native_uint48_buf_t;
typedef big_uint56_buf_t native_uint56_buf_t;
typedef big_uint64_buf_t native_uint64_buf_t;
// native endian floating point buffers
typedef big_float32_buf_t native_float32_buf_t;
typedef big_float64_buf_t native_float64_buf_t;
typedef big_float32_buf_at native_float32_buf_at;
typedef big_float64_buf_at native_float64_buf_at;
# else
// unaligned native endian signed integer buffers
typedef little_int8_buf_t native_int8_buf_t;
@@ -205,12 +183,6 @@ namespace endian
typedef little_uint48_buf_t native_uint48_buf_t;
typedef little_uint56_buf_t native_uint56_buf_t;
typedef little_uint64_buf_t native_uint64_buf_t;
// native endian floating point buffers
typedef little_float32_buf_t native_float32_buf_t;
typedef little_float64_buf_t native_float64_buf_t;
typedef little_float32_buf_at native_float32_buf_at;
typedef little_float64_buf_at native_float64_buf_at;
# endif
// Stream inserter
+1 -22
View File
@@ -61,9 +61,6 @@ namespace endian
inline uint16_t endian_reverse(uint16_t x) BOOST_NOEXCEPT;
inline uint32_t endian_reverse(uint32_t x) BOOST_NOEXCEPT;
inline uint64_t endian_reverse(uint64_t x) BOOST_NOEXCEPT;
// TODO: Track N3626,Floating-Point Typedefs Having Specified Widths, proposal
inline float endian_reverse(float x) BOOST_NOEXCEPT;
inline double endian_reverse(double x) BOOST_NOEXCEPT;
// reverse byte order unless native endianness is big
template <class EndianReversible >
@@ -162,9 +159,7 @@ namespace endian
{
// generic reverse function template implementation approach using std::reverse
// suggested by Mathias Gaunard. Primary motivation for inclusion is to have an
// independent implementation to test against. Secondary motivation is use by
// floating-point endian_reverse, but that use is likely to be replace by a
// more tailored floating-point implementation.
// independent implementation to test against.
template <class T>
inline T std_endian_reverse(T x) BOOST_NOEXCEPT
@@ -283,22 +278,6 @@ namespace endian
# endif
}
inline float endian_reverse(float x) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT_MSG(sizeof(float) == sizeof(uint32_t),
"boost::endian currently supports only sizeof(float) == 4;"
" please report static_assert failure to the boost mailing list");
return detail::std_endian_reverse(x);
}
inline double endian_reverse(double x) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT_MSG(sizeof(double) == sizeof(uint64_t),
"boost::endian currently supports only sizeof(double) == 8;"
" please report static_assert failure to the boost mailing list");
return detail::std_endian_reverse(x);
}
template <class EndianReversible >
inline EndianReversible big_to_native(EndianReversible x) BOOST_NOEXCEPT
{