Drop the _unless_big and _unless_little functions. KISS. They were confusing, and less confusing names were never found.

This commit is contained in:
Beman
2014-12-09 20:43:47 -05:00
parent 55a65c3806
commit e4466edf4e
5 changed files with 185 additions and 203 deletions
-56
View File
@@ -72,9 +72,6 @@ namespace endian
template <class Reversible >
inline Reversible native_to_big(Reversible x) BOOST_NOEXCEPT;
// Returns: x if native endian order is big, otherwise reverse_endianness(x)
template <class Reversible >
inline Reversible reverse_unless_native_big(Reversible x) BOOST_NOEXCEPT;
// Returns: x if native endian order is big, otherwise reverse_endianness(x)
// reverse byte order unless native endianness is little
template <class Reversible >
@@ -83,9 +80,6 @@ namespace endian
template <class Reversible >
inline Reversible native_to_little(Reversible x) BOOST_NOEXCEPT;
// Returns: x if native endian order is little, otherwise reverse_endianness(x)
template <class Reversible >
inline Reversible reverse_unless_native_little(Reversible x) BOOST_NOEXCEPT;
// Returns: x if native endian order is little, otherwise reverse_endianness(x)
// generic conditional reverse byte order
template <BOOST_SCOPED_ENUM(order) From, BOOST_SCOPED_ENUM(order) To, class Reversible>
@@ -140,9 +134,6 @@ namespace endian
template <class Reversible>
inline void native_to_big_in_place(Reversible& x) BOOST_NOEXCEPT;
// Effects: none if native byte-order is big, otherwise reverse_endianness_in_place(x)
template <class Reversible>
inline void reverse_in_place_unless_native_big(Reversible& x) BOOST_NOEXCEPT;
// Effects: none if native byte-order is big, otherwise reverse_endianness_in_place(x)
// reverse in place unless native endianness is little
template <class Reversible>
@@ -151,9 +142,6 @@ namespace endian
template <class Reversible>
inline void native_to_little_in_place(Reversible& x) BOOST_NOEXCEPT;
// Effects: none if native byte-order is little, otherwise reverse_endianness_in_place(x);
template <class Reversible>
inline void reverse_in_place_unless_native_little(Reversible& x) BOOST_NOEXCEPT;
// Effects: none if native byte-order is little, otherwise reverse_endianness_in_place(x);
// generic conditional reverse in place
template <BOOST_SCOPED_ENUM(order) From, BOOST_SCOPED_ENUM(order) To, class Reversible>
@@ -328,16 +316,6 @@ namespace endian
# endif
}
template <class Reversible >
inline Reversible reverse_unless_native_big(Reversible x) BOOST_NOEXCEPT
{
# ifdef BOOST_BIG_ENDIAN
return x;
# else
return reverse_endianness(x);
# endif
}
template <class Reversible >
inline Reversible little_to_native(Reversible x) BOOST_NOEXCEPT
{
@@ -358,16 +336,6 @@ namespace endian
# endif
}
template <class Reversible >
inline Reversible reverse_unless_native_little(Reversible x) BOOST_NOEXCEPT
{
# ifdef BOOST_LITTLE_ENDIAN
return x;
# else
return reverse_endianness(x);
# endif
}
namespace detail
{
// Primary template and specializations to support reverse_endianness().
@@ -413,9 +381,6 @@ namespace endian
x = reverse_endianness(x);
}
// reverse in place unless native endianness is big
// Effects: none if native endian order is big,
// otherwise reverse_endianness_in_place(x)
template <class Reversible>
# ifdef BOOST_BIG_ENDIAN
inline void big_to_native_in_place(Reversible&) BOOST_NOEXCEPT {}
@@ -432,19 +397,7 @@ namespace endian
reverse_endianness_in_place(x);
}
# endif
template <class Reversible>
# ifdef BOOST_BIG_ENDIAN
inline void reverse_in_place_unless_native_big(Reversible&) BOOST_NOEXCEPT {}
# else
inline void reverse_in_place_unless_native_big(Reversible& x) BOOST_NOEXCEPT
{
reverse_endianness_in_place(x);
}
# endif
// reverse in place unless native endianness is little
// Effects: none if native endian order is little,
// otherwise reverse_endianness_in_place(x)
template <class Reversible>
# ifdef BOOST_LITTLE_ENDIAN
inline void little_to_native_in_place(Reversible&) BOOST_NOEXCEPT {}
@@ -461,15 +414,6 @@ namespace endian
reverse_endianness_in_place(x);
}
# endif
template <class Reversible>
# ifdef BOOST_LITTLE_ENDIAN
inline void reverse_in_place_unless_native_little(Reversible&) BOOST_NOEXCEPT {}
# else
inline void reverse_in_place_unless_native_little(Reversible& x) BOOST_NOEXCEPT
{
reverse_endianness_in_place(x);
}
# endif
namespace detail
{