Teuchos - Trilinos Tools Package
Version of the Day
|
Utilities for generating hashcodes. This is not a true hash ! For all ints and types less than ints it returns the i/p typecasted as an int. For every type more than the size of int it is only slightly more smarter where it adds the bits into int size chunks and calls that an hash. Used with a capacity limited array this will lead to one of the simplest hashes. Ideally this should be deprecated and not used at all. More...
#include <Teuchos_HashUtils.hpp>
Static Public Member Functions | |
static int | getHashCode (const unsigned char *a, size_t len) |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
int | hashCode (const T &x) |
Standard interface for getting the hash code of an object. More... | |
template<> | |
int | hashCode (const int &x) |
Get the hash code of an int. More... | |
template<> | |
int | hashCode (const unsigned &x) |
Get the hash code of an unsigned. More... | |
template<> | |
int | hashCode (const double &x) |
Get the hash code of a double. More... | |
template<> | |
int | hashCode (const bool &x) |
Get the hash code of a bool. More... | |
template<> | |
int | hashCode (const long long &x) |
Get the hash code of a long long. More... | |
template<> | |
int | hashCode (const long &x) |
Get the hash code of a long. More... | |
template<> | |
int | hashCode (const std::string &x) |
Get the hash code of a std::string. More... | |
Utilities for generating hashcodes. This is not a true hash ! For all ints and types less than ints it returns the i/p typecasted as an int. For every type more than the size of int it is only slightly more smarter where it adds the bits into int size chunks and calls that an hash. Used with a capacity limited array this will lead to one of the simplest hashes. Ideally this should be deprecated and not used at all.
Definition at line 34 of file Teuchos_HashUtils.hpp.
|
static |
helper to hash values larger than int to an int. This is similar to the version in Zoltan2, not a true hash, but this is an improvement over what was done before which was typecasting everything to ints and returning -ve hash codes which was in turn used to index arrays.
Definition at line 52 of file Teuchos_HashUtils.cpp.
|
related |
Standard interface for getting the hash code of an object.
|
related |
Get the hash code of an int.
Definition at line 63 of file Teuchos_HashUtils.hpp.
|
related |
Get the hash code of an unsigned.
Definition at line 71 of file Teuchos_HashUtils.hpp.
|
related |
Get the hash code of a double.
Definition at line 80 of file Teuchos_HashUtils.hpp.
|
related |
Get the hash code of a bool.
Definition at line 89 of file Teuchos_HashUtils.hpp.
|
related |
Get the hash code of a long long.
Definition at line 97 of file Teuchos_HashUtils.hpp.
|
related |
Get the hash code of a long.
Definition at line 106 of file Teuchos_HashUtils.hpp.
|
related |
Get the hash code of a std::string.
Definition at line 115 of file Teuchos_HashUtils.hpp.