Program Listing for File HashFunctions.h

↰ Return to documentation for file (ADS/dictionary/HashFunctions.h)

/*--------------------------------------------------------------------------*/
/*-------------------------- File HashFunctions.h --------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_HashFunctions
 #define __ADS_HashFunctions
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/Contract.h"

#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string_view>

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

/*--------------------------------------------------------------------------*/
/*----------------------------- HASH FUNCTIONS -----------------------------*/
/*--------------------------------------------------------------------------*/

unsigned bin_bit( std::string_view k , std::size_t j );

std::uint64_t int_bin( std::string_view k );

std::uint64_t hash_extraction( std::string_view k , int p , std::size_t s );

std::uint64_t hash_xor( std::string_view k , int p );

std::uint64_t hash_division( std::string_view k , std::uint64_t m ,
                             std::uint64_t base = 256 ,
                             std::uint64_t seed = 0 );

std::uint64_t hash_multiplication( std::uint64_t i , std::uint64_t m ,
                                   long double C =
                                    ( std::sqrt( 5.0L ) - 1 ) / 2 );

std::uint64_t hash_fibonacci( std::uint64_t i , int p );

std::uint64_t hash_midsquare( std::uint64_t i , int p );

/*--------------------------------------------------------------------------*/

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/dictionary/impl/HashFunctions.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* HashFunctions.h included */

/*--------------------------------------------------------------------------*/
/*------------------------ End File HashFunctions.h ------------------------*/
/*--------------------------------------------------------------------------*/