mirror of
https://github.com/boostorg/endian.git
synced 2025-08-01 21:44:31 +02:00
Eliminate warnings
git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@72124 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
@@ -196,69 +196,26 @@ namespace endian
|
|||||||
*--t = *++s;
|
*--t = *++s;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> inline void to_big(T& x)
|
#ifdef BOOST_LITTLE_ENDIAN
|
||||||
{
|
template <class T> inline void to_big(T& x) { flip(x); }
|
||||||
# ifdef BOOST_LITTLE_ENDIAN
|
template <class T> inline void to_little(T&) {}
|
||||||
flip(x);
|
template <class T> inline void from_big(T& x) { flip(x); }
|
||||||
# endif
|
template <class T> inline void from_little(T&) {}
|
||||||
}
|
template <class T> inline void to_big(T native, T& big) { flip(native, big); }
|
||||||
|
template <class T> inline void to_little(T native, T& little) { little = native; }
|
||||||
|
template <class T> inline void from_big(T big, T& native) { flip(big, native); }
|
||||||
|
template <class T> inline void from_little(T little, T& native) { native = little; }
|
||||||
|
#else
|
||||||
|
template <class T> inline void to_big(T&) {}
|
||||||
|
template <class T> inline void to_little(T& x) { flip(x); }
|
||||||
|
template <class T> inline void from_big(T&) {}
|
||||||
|
template <class T> inline void from_little(T& x) { flip(x); }
|
||||||
|
template <class T> inline void to_big(T native, T& big) { big = native; }
|
||||||
|
template <class T> inline void to_little(T native, T& little) { flip(native, little); }
|
||||||
|
template <class T> inline void from_big(T big, T& native) { native = big; }
|
||||||
|
template <class T> inline void from_little(T little, T& native) { flip(little, native); }
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T> inline void to_little(T& x)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_BIG_ENDIAN
|
|
||||||
flip(x);
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> inline void from_big(T& x)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_LITTLE_ENDIAN
|
|
||||||
flip(x);
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> inline void from_little(T& x)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_BIG_ENDIAN
|
|
||||||
flip(x);
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> inline void to_big(T native, T& big)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_LITTLE_ENDIAN
|
|
||||||
flip(native, big);
|
|
||||||
# else
|
|
||||||
big = native;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> inline void to_little(T native, T& little)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_BIG_ENDIAN
|
|
||||||
flip(native, little);
|
|
||||||
# else
|
|
||||||
little = native;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> inline void from_big(T big, T& native)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_LITTLE_ENDIAN
|
|
||||||
flip(big, native);
|
|
||||||
# else
|
|
||||||
native = big;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> inline void from_little(T little, T& native)
|
|
||||||
{
|
|
||||||
# ifdef BOOST_BIG_ENDIAN
|
|
||||||
flip(little, native);
|
|
||||||
# else
|
|
||||||
native = little;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
} // namespace endian
|
} // namespace endian
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
23
boost/endian/detail/disable_warnings.hpp
Normal file
23
boost/endian/detail/disable_warnings.hpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// disable_warnings.hpp --------------------------------------------------------------//
|
||||||
|
|
||||||
|
// Copyright Beman Dawes 2011
|
||||||
|
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# pragma warning(push)
|
||||||
|
|
||||||
|
// triggered by boost/detail/lightweight_test.hpp
|
||||||
|
# pragma warning( disable : 4640 ) // ... construction of local static object is not thread-safe
|
||||||
|
|
||||||
|
// triggered by Microsoft's own headers, so disable
|
||||||
|
# pragma warning( disable : 4820 ) // padding added after data member
|
||||||
|
# pragma warning( disable : 4548 ) // expression before comma has no effect
|
||||||
|
# pragma warning( disable : 4668 ) // ... is not defined as a preprocessor macro
|
||||||
|
# pragma warning( disable : 4514 ) // ... unreferenced inline function has been removed
|
||||||
|
# pragma warning( disable : 4710 ) // ... function not inlined
|
||||||
|
# pragma warning( disable : 4986 ) // ... exception specification does not match previous declaration
|
||||||
|
#endif
|
12
boost/endian/detail/disable_warnings_pop.hpp
Normal file
12
boost/endian/detail/disable_warnings_pop.hpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// disable_warnings_pop.hpp ----------------------------------------------------------//
|
||||||
|
|
||||||
|
// Copyright Beman Dawes 2011
|
||||||
|
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# pragma warning(push)
|
||||||
|
#endif
|
Reference in New Issue
Block a user