diff --git a/include/boost/endian/conversion.hpp b/include/boost/endian/conversion.hpp index 32ef5c5..9880dc8 100644 --- a/include/boost/endian/conversion.hpp +++ b/include/boost/endian/conversion.hpp @@ -47,28 +47,28 @@ namespace endian // reverse byte order // requires T to be a non-bool integral type // in detail/endian_reverse.hpp - template inline T endian_reverse( T x ) BOOST_NOEXCEPT; + template inline BOOST_CONSTEXPR T endian_reverse( T x ) BOOST_NOEXCEPT; // reverse byte order unless native endianness is big template - inline EndianReversible big_to_native(EndianReversible x) BOOST_NOEXCEPT; + inline BOOST_CONSTEXPR EndianReversible big_to_native(EndianReversible x) BOOST_NOEXCEPT; // Returns: x if native endian order is big, otherwise endian_reverse(x) template - inline EndianReversible native_to_big(EndianReversible x) BOOST_NOEXCEPT; + inline BOOST_CONSTEXPR EndianReversible native_to_big(EndianReversible x) BOOST_NOEXCEPT; // Returns: x if native endian order is big, otherwise endian_reverse(x) // reverse byte order unless native endianness is little template - inline EndianReversible little_to_native(EndianReversible x) BOOST_NOEXCEPT; + inline BOOST_CONSTEXPR EndianReversible little_to_native(EndianReversible x) BOOST_NOEXCEPT; // Returns: x if native endian order is little, otherwise endian_reverse(x) template - inline EndianReversible native_to_little(EndianReversible x) BOOST_NOEXCEPT; + inline BOOST_CONSTEXPR EndianReversible native_to_little(EndianReversible x) BOOST_NOEXCEPT; // Returns: x if native endian order is little, otherwise endian_reverse(x) // generic conditional reverse byte order template - inline EndianReversible conditional_reverse(EndianReversible from) BOOST_NOEXCEPT; + inline BOOST_CONSTEXPR EndianReversible conditional_reverse(EndianReversible from) BOOST_NOEXCEPT; // Returns: If From == To have different values, from. // Otherwise endian_reverse(from). // Remarks: The From == To test, and as a consequence which form the return takes, is @@ -76,7 +76,7 @@ namespace endian // runtime conditional reverse byte order template - inline EndianReversible conditional_reverse(EndianReversible from, + inline BOOST_CONSTEXPR EndianReversible conditional_reverse(EndianReversible from, BOOST_SCOPED_ENUM(order) from_order, BOOST_SCOPED_ENUM(order) to_order) BOOST_NOEXCEPT; // Returns: from_order == to_order ? from : endian_reverse(from). @@ -154,7 +154,7 @@ template struct is_endian_reversible: boost::integral_constant -inline EndianReversible big_to_native( EndianReversible x ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible big_to_native( EndianReversible x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( detail::is_endian_reversible::value ); @@ -170,7 +170,7 @@ inline EndianReversible big_to_native( EndianReversible x ) BOOST_NOEXCEPT } template -inline EndianReversible native_to_big( EndianReversible x ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible native_to_big( EndianReversible x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( detail::is_endian_reversible::value ); @@ -186,7 +186,7 @@ inline EndianReversible native_to_big( EndianReversible x ) BOOST_NOEXCEPT } template -inline EndianReversible little_to_native( EndianReversible x ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible little_to_native( EndianReversible x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( detail::is_endian_reversible::value ); @@ -202,7 +202,7 @@ inline EndianReversible little_to_native( EndianReversible x ) BOOST_NOEXCEPT } template -inline EndianReversible native_to_little( EndianReversible x ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible native_to_little( EndianReversible x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( detail::is_endian_reversible::value ); @@ -221,13 +221,13 @@ namespace detail { template -inline EndianReversible conditional_reverse_impl( EndianReversible x, boost::true_type ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible conditional_reverse_impl( EndianReversible x, boost::true_type ) BOOST_NOEXCEPT { return x; } template -inline EndianReversible conditional_reverse_impl( EndianReversible x, boost::false_type ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible conditional_reverse_impl( EndianReversible x, boost::false_type ) BOOST_NOEXCEPT { return endian_reverse( x ); } @@ -236,7 +236,7 @@ inline EndianReversible conditional_reverse_impl( EndianReversible x, boost::fal // generic conditional reverse template -inline EndianReversible conditional_reverse( EndianReversible x ) BOOST_NOEXCEPT +inline BOOST_CONSTEXPR EndianReversible conditional_reverse( EndianReversible x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( detail::is_endian_reversible::value ); return detail::conditional_reverse_impl( x, boost::integral_constant() ); @@ -244,7 +244,7 @@ inline EndianReversible conditional_reverse( EndianReversible x ) BOOST_NOEXCEPT // runtime conditional reverse template -inline EndianReversible conditional_reverse( EndianReversible x, +inline BOOST_CONSTEXPR EndianReversible conditional_reverse( EndianReversible x, BOOST_SCOPED_ENUM(order) from_order, BOOST_SCOPED_ENUM(order) to_order ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( detail::is_endian_reversible::value ); diff --git a/include/boost/endian/detail/endian_reverse.hpp b/include/boost/endian/detail/endian_reverse.hpp index cb80c79..b619657 100644 --- a/include/boost/endian/detail/endian_reverse.hpp +++ b/include/boost/endian/detail/endian_reverse.hpp @@ -82,7 +82,7 @@ inline uint64_t endian_reverse_impl(uint64_t x) BOOST_NOEXCEPT // Requires: // T is non-bool integral -template inline T endian_reverse( T x ) BOOST_NOEXCEPT +template inline BOOST_CONSTEXPR T endian_reverse( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( is_integral::value && !is_same::value );