Add mulxp3_hash32 to benchmarks

This commit is contained in:
Peter Dimov
2022-11-27 02:43:20 +02:00
parent 558d0ead17
commit e310932a9c
3 changed files with 61 additions and 0 deletions
+23
View File
@@ -288,7 +288,11 @@ struct mul31_x8_hash
char const * p = st.data();
std::size_t n = st.size();
#if SIZE_MAX > UINT32_MAX
boost::uint64_t h = 0xCBF29CE484222325ull;
#else
boost::uint64_t h = 0x811C9DC5u;
#endif
while( n >= 8 )
{
@@ -427,6 +431,24 @@ struct mulxp3_hash_
}
};
struct mulxp3_hash32_
{
using is_avalanching = void;
std::size_t operator()( std::string_view const& st ) const BOOST_NOEXCEPT
{
std::size_t r = mulxp3_hash32( (unsigned char const*)st.data(), st.size(), 0 );
#if SIZE_MAX > UINT32_MAX
r |= r << 32;
#endif
return r;
}
};
#endif
//
@@ -454,6 +476,7 @@ int main()
test< mulxp1_hash_ >( "mulxp1_hash" );
test< mulxp2_hash_ >( "mulxp2_hash" );
test< mulxp3_hash_ >( "mulxp3_hash" );
test< mulxp3_hash32_ >( "mulxp3_hash32" );
#endif