/usr/include/polybori/routines/pbori_routines_hash.h is in libpolybori-dev 0.8.3-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | // -*- c++ -*-
//*****************************************************************************
/** @file pbori_routines_hash.h
*
* @author Alexander Dreyer
* @date 2006-08-23
*
* This file includes files, which defines miscellaneous function templates.
*
* @par Copyright:
* (c) 2006 by The PolyBoRi Team
**/
//*****************************************************************************
#ifndef polybori_routines_pbori_routines_hash_h_
#define polybori_routines_pbori_routines_hash_h_
// include basic definitions
#include <polybori/pbori_defs.h>
#include <boost/functional/hash.hpp>
BEGIN_NAMESPACE_PBORI
template <class HashType, class NaviType>
void
stable_hash_range(HashType& seed, NaviType navi) {
if (navi.isConstant()) {
if (navi.terminalValue())
boost::hash_combine(seed, CTypes::max_index());
return;
}
boost::hash_combine(seed, *navi);
stable_hash_range(seed, navi.thenBranch());
stable_hash_range(seed, navi.elseBranch());
}
template <class NaviType>
std::size_t
stable_hash_range(NaviType navi) {
std::size_t seed = 0;
stable_hash_range(seed, navi);
return seed;
}
template <class HashType>
void
finalize_term_hash(HashType& seed) {
boost::hash_combine(seed, CTypes::max_index());
}
template <class HashType, class NaviType>
void
stable_first_hash_range(HashType& seed, NaviType navi) {
while (!navi.isConstant()) {
boost::hash_combine(seed, *navi);
navi.incrementThen();
}
if (navi.terminalValue())
finalize_term_hash(seed);
}
template <class NaviType>
std::size_t
stable_first_hash_range(NaviType navi) {
std::size_t seed = 0;
stable_first_hash_range(seed, navi);
return seed;
}
template <class HashType, class Iterator>
void
stable_term_hash(HashType& seed, Iterator start, Iterator finish) {
boost::hash_range(seed, start, finish);
finalize_term_hash(seed);
}
template <class Iterator>
std::size_t
stable_term_hash(Iterator start, Iterator finish) {
std::size_t seed(0);
stable_term_hash(seed, start, finish);
return seed;
}
END_NAMESPACE_PBORI
#endif
|