diff --git a/include/boost/endian/detail/endian_load.hpp b/include/boost/endian/detail/endian_load.hpp index 8e8a3f7..8dd9a20 100644 --- a/include/boost/endian/detail/endian_load.hpp +++ b/include/boost/endian/detail/endian_load.hpp @@ -33,13 +33,17 @@ template inline T endian_load( unsigned char const * p ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( sizeof(T) == 1 || sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8 ); + BOOST_STATIC_ASSERT( N >= 1 && N <= sizeof(T) ); + return detail::endian_load_impl()( p ); } diff --git a/include/boost/endian/detail/endian_store.hpp b/include/boost/endian/detail/endian_store.hpp index 06b4d90..a624352 100644 --- a/include/boost/endian/detail/endian_store.hpp +++ b/include/boost/endian/detail/endian_store.hpp @@ -32,13 +32,17 @@ template inline void endian_store( unsigned char * p, T const & v ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( sizeof(T) == 1 || sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8 ); + BOOST_STATIC_ASSERT( N >= 1 && N <= sizeof(T) ); + return detail::endian_store_impl()( p, v ); }