32#ifndef MADNESS_WORLD_WORLDHASH_H__INCLUDED
33#define MADNESS_WORLD_WORLDHASH_H__INCLUDED
133#include <type_traits>
156 inline typename std::enable_if<std::is_fundamental<T>::value &&
157 ((
sizeof(T)%
sizeof(uint32_t)) == 0),
160 alignas(uint32_t) uint32_t buf[
sizeof(T)/
sizeof(uint32_t)];
161 std::memcpy(buf, &t,
sizeof(T));
163 std::integral_constant<std::size_t,
sizeof(T)/
sizeof(uint32_t)>::value, 0
u);
172 inline typename std::enable_if<std::is_fundamental<T>::value &&
173 ((
sizeof(T)%
sizeof(uint32_t)) != 0),
177 result =
hashlittle(
reinterpret_cast<const void*
>(&t),
sizeof(T), 0
u);
186 template <
typename T>
188 const unsigned long n =
reinterpret_cast<unsigned long>(t);
197 template <typename T, typename = std::enable_if_t<std::is_same_v<decltype(std::declval<const T&>().hash()),
hashT>>>
208 template <
typename T>
215 template <
typename T,
typename R>
233 template <
typename T>
250 seed ^= hash + 0x9e3779b9 + (seed<<6) + (seed>>2);
266 template <
typename T,
typename R>
283 for(; first != last; ++first)
307 template <
class T, std::
size_t n>
319 template <
class T, std::
size_t n>
333 inline typename std::enable_if<std::is_fundamental<T>::value >
::type
335 const std::size_t bytes = n *
sizeof(T);
336 if((bytes %
sizeof(uint32_t)) == 0)
337 seed =
hashword(
reinterpret_cast<const uint32_t *
>(t), bytes/
sizeof(uint32_t), seed);
339 seed =
hashlittle(
static_cast<const void *
>(t), bytes, seed);
349 inline typename std::enable_if<!std::is_fundamental<T>::value >
::type
367 template <
typename T>
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval)
Definition lookup3.c:189
uint32_t hashlittle(const void *key, size_t length, uint32_t initval)
Definition lookup3.c:253
static const double v
Definition hatom_sf_dirac.cc:20
static double u(double r, double c)
Definition he.cc:20
static const double length
Definition hedft.cc:48
Macros and tools pertaining to the configuration of MADNESS.
Definition potentialmanager.cc:41
void combine_hash(hashT &seed, hashT hash)
Internal use only.
Definition worldhash.h:249
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
void hash_range(hashT &seed, It first, It last)
Definition worldhash.h:281
void hash_combine(hashT &seed, const T &v)
Combine hash values.
Definition worldhash.h:261
std::size_t hashT
The hash value type.
Definition worldhash.h:146
std::string type(const PairType &n)
Definition PNOParameters.h:18
madness::hashT hash_value(const std::array< T, N > &a)
Hash std::array with madness hash.
Definition array_addons.h:78
static const long k
Definition rk.cc:44
Hash functor.
Definition worldhash.h:234
hashT operator()(const T &t) const
Hashing function wrapper.
Definition worldhash.h:240