Take care of g++ warning on 4294967291

This commit is contained in:
Peter Dimov
2021-10-17 00:47:28 +03:00
parent 7f2a43226e
commit 24598bd45f

View File

@@ -87,7 +87,8 @@ namespace boost
static std::size_t fn( T v ) static std::size_t fn( T v )
{ {
// 4294967291 = 2^32-5, biggest prime under 2^32 // 4294967291 = 2^32-5, biggest prime under 2^32
return static_cast<std::size_t>( static_cast<typename boost::make_unsigned<T>::type>( v ) % 4294967291 ); // we use boost::uint32_t( -5 ), because g++ warns on 4294967291
return static_cast<std::size_t>( static_cast<typename boost::make_unsigned<T>::type>( v ) % static_cast<boost::uint32_t>( -5 ) );
} }
}; };