Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions include/boost/hash2/xxh3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,8 @@ class xxh3_128

private: // supporting constructor for the static factory functions

BOOST_CXX14_CONSTEXPR xxh3_128( std::uint64_t seed, unsigned char const* p, std::size_t n ): seed_( seed )
BOOST_CXX14_CONSTEXPR xxh3_128( std::uint64_t seed, unsigned char const* p, std::size_t n, bool with_secret ): seed_( seed ), with_secret_( with_secret )
{
with_secret_ = true;

if( n < min_secret_len )
{
// this is a precondition violation for XXH3, but we try to do something reasonable
Expand Down Expand Up @@ -605,33 +603,29 @@ class xxh3_128
// XXH3-specific named constructors, matching the reference implementation

// for completeness only
static BOOST_CXX14_CONSTEXPR xxh3_128 withSeed( std::uint64_t seed )
static BOOST_CXX14_CONSTEXPR xxh3_128 with_seed( std::uint64_t seed )
{
return xxh3_128( seed );
}

static BOOST_CXX14_CONSTEXPR xxh3_128 withSecret( unsigned char const* p, std::size_t n )
static BOOST_CXX14_CONSTEXPR xxh3_128 with_secret( unsigned char const* p, std::size_t n )
{
return xxh3_128( 0, p, n );
return xxh3_128( 0, p, n, true );
}

static xxh3_128 withSecret( void const* p, std::size_t n )
static xxh3_128 with_secret( void const* p, std::size_t n )
{
return withSecret( static_cast<unsigned char const*>( p ), n );
return with_secret( static_cast<unsigned char const*>( p ), n );
}

static BOOST_CXX14_CONSTEXPR xxh3_128 withSecretAndSeed( unsigned char const* p, std::size_t n, std::uint64_t seed )
static BOOST_CXX14_CONSTEXPR xxh3_128 with_secret_and_seed( unsigned char const* p, std::size_t n, std::uint64_t seed )
{
xxh3_128 r( seed, p, n );

r.with_secret_ = false;

return r;
return xxh3_128( seed, p, n, false );
}

static xxh3_128 withSecretAndSeed( void const* p, std::size_t n, std::uint64_t seed )
static xxh3_128 with_secret_and_seed( void const* p, std::size_t n, std::uint64_t seed )
{
return withSecretAndSeed( static_cast<unsigned char const*>( p ), n, seed );
return with_secret_and_seed( static_cast<unsigned char const*>( p ), n, seed );
}

void update( void const* p, std::size_t n )
Expand Down
Loading