From 6ebccd6c80b7f15be9131156bff68d02658c2caa Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Wed, 26 Apr 2017 14:49:04 +0200 Subject: [PATCH] fix narrowing warnings due to integer promotion. Signed-off-by: Daniela Engert --- include/boost/integer/integer_mask.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/integer/integer_mask.hpp b/include/boost/integer/integer_mask.hpp index 2cc9a1d..eee4679 100644 --- a/include/boost/integer/integer_mask.hpp +++ b/include/boost/integer/integer_mask.hpp @@ -57,19 +57,27 @@ struct high_bit_mask_t // Makes masks for the lowest N bits // (Specializations are needed when N fills up a type.) +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4310) // cast truncates constant value +#endif + template < std::size_t Bits > struct low_bits_mask_t { typedef typename uint_t::least least; typedef typename uint_t::fast fast; - BOOST_STATIC_CONSTANT( least, sig_bits = (~(least(~(least( 0u ))) << Bits )) ); + BOOST_STATIC_CONSTANT( least, sig_bits = least(~(least(~(least( 0u ))) << Bits )) ); BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); }; // boost::low_bits_mask_t +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif #define BOOST_LOW_BITS_MASK_SPECIALIZE( Type ) \ template < > struct low_bits_mask_t< std::numeric_limits::digits > { \