/usr/include/osl/hash/hashKey.h is in libosl-dev 0.4.2-1.
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 101 102 103 104 105 106 | /* hashKey.h
*/
#ifndef _HASH_KEY_H
#define _HASH_KEY_H
#include "osl/config.h"
#include "osl/hash/boardKey.h"
#include "osl/piece.h"
#include "osl/move.h"
#include "osl/pieceStand.h"
#include "osl/state/simpleState.h"
#include "osl/misc/carray.h"
namespace osl
{
namespace hash
{
#if OSL_WORDSIZE == 64
typedef HashKey64 HashKeyBase;
typedef BoardKey64 BoardKey;
#elif OSL_WORDSIZE == 32
typedef HashKey32 HashKeyBase;
typedef BoardKey32 BoardKey;
#endif
class HashKey : public HashKeyBase
{
public:
HashKey() :HashKeyBase(){}
HashKey(const SimpleState&);
const HashKey newHashWithMove(Move move) const;
const HashKey newMakeMove(Move) const;
const HashKey newUnmakeMove(Move) const;
void dumpContents(std::ostream& os) const;
void dumpContentsCerr() const;
static const HashKey readFromDump(const std::string&);
static const HashKey readFromDump(std::istream&);
};
std::ostream& operator<<(std::ostream& os,const HashKey& h);
class HashGenTable
{
CArray2d<HashKey,Square::SIZE,PTYPEO_SIZE> hashKey;
public:
HashGenTable();
void addHashKey(HashKey& hk,Square pos,PtypeO ptypeo) const{
assert(pos.isValid() && isValidPtypeO(ptypeo));
hk+=hashKey[pos.index()][ptypeo-PTYPEO_MIN];
}
void subHashKey(HashKey& hk,Square pos,PtypeO ptypeo) const{
assert(pos.isValid() && isValidPtypeO(ptypeo));
hk-=hashKey[pos.index()][ptypeo-PTYPEO_MIN];
}
};
extern const HashGenTable Hash_Gen_Table;
} // namespace hash
using hash::HashKey;
using hash::BoardKey;
namespace stl
{
template <typename T> struct hash;
template <>
struct hash<osl::hash::HashKey>{
unsigned long operator()(const HashKey& h) const{
return h.signature();
}
};
template<>
struct hash<osl::hash::BoardKey>
{
unsigned long operator()(const BoardKey& h) const
{
return h.signature();
}
};
} // namespace stl
#ifdef USE_TBB_HASH
struct TBBHashCompare
{
size_t hash(HashKey const& key) const {
return (size_t)(key.signature());
}
bool equal(HashKey const& key1, HashKey const& key2) const {
return key1==key2;
}
};
struct TBBSignatureCompare
{
size_t hash(hash::BoardKey const& key) const {
return (size_t)key.signature();
}
bool equal(hash::BoardKey const& key1, hash::BoardKey const& key2) const {
return key1==key2;
}
};
#endif
} // namespace osl
#endif /* _HASH_KEY_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|