BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslh::FibonacciBadHashWrapper< HASH > Class Template Reference

#include <bslh_fibonaccibadhashwrapper.h>

Public Member Functions

 FibonacciBadHashWrapper ()
 
 FibonacciBadHashWrapper (const HASH &hash)
 Create a FibonacciBadHashWrapper having the specified hash.
 
 FibonacciBadHashWrapper (const FibonacciBadHashWrapper &original)=default
 
 ~FibonacciBadHashWrapper ()=default
 
FibonacciBadHashWrapperoperator= (const FibonacciBadHashWrapper &rhs)=default
 
template<class KEY >
size_t operator() (const KEY &key) const
 

Static Public Attributes

static const bsls::Types::Uint64 k_FIBONACCI_HASH_MULTIPLIER = 11400714819323198485ull
 

Detailed Description

template<class HASH>
class bslh::FibonacciBadHashWrapper< HASH >

This class provides a hash algorithm wrapper that improves the distribution of varying bits from the HASH applied to the KEY.

See bslh_fibonaccibadhashwrapper

Constructor & Destructor Documentation

◆ FibonacciBadHashWrapper() [1/3]

template<class HASH >
bslh::FibonacciBadHashWrapper< HASH >::FibonacciBadHashWrapper ( )
inline

Create a FibonacciBadHashWrapper having a default constructed hash.

◆ FibonacciBadHashWrapper() [2/3]

template<class HASH >
bslh::FibonacciBadHashWrapper< HASH >::FibonacciBadHashWrapper ( const HASH &  hash)
inlineexplicit

◆ FibonacciBadHashWrapper() [3/3]

template<class HASH >
bslh::FibonacciBadHashWrapper< HASH >::FibonacciBadHashWrapper ( const FibonacciBadHashWrapper< HASH > &  original)
default

◆ ~FibonacciBadHashWrapper()

template<class HASH >
bslh::FibonacciBadHashWrapper< HASH >::~FibonacciBadHashWrapper ( )
default

Member Function Documentation

◆ operator()()

template<class HASH >
template<class KEY >
size_t bslh::FibonacciBadHashWrapper< HASH >::operator() ( const KEY &  key) const
inline

Return the hash of the specified key, computed as the product of the result of the hash function supplied at construction and k_FIBONACCI_HASH_MULTIPLIER.

◆ operator=()

template<class HASH >
FibonacciBadHashWrapper & bslh::FibonacciBadHashWrapper< HASH >::operator= ( const FibonacciBadHashWrapper< HASH > &  rhs)
default

Member Data Documentation

◆ k_FIBONACCI_HASH_MULTIPLIER

template<class HASH >
const bsls::Types::Uint64 bslh::FibonacciBadHashWrapper< HASH >::k_FIBONACCI_HASH_MULTIPLIER = 11400714819323198485ull
static

The value corresponds to:

2^64 / phi - 1

where phi is the Golden Ratio and 1 is subtracted to avoid the value being a multiple of 2 (that would throw away one bit of information from the resultant hash value). See https://en.wikipedia.org/wiki/Hash_function#Fibonacci_hashing.


The documentation for this class was generated from the following file: