Rev 96 | Rev 169 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 96 | Rev 154 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | struct TTEntry { |
37 | struct TTEntry { |
38 | 38 | ||
39 | Move move() const { return (Move )move16; } |
39 | Move move() const { return (Move )move16; } |
40 | Value value() const { return (Value)value16; } |
40 | Value value() const { return (Value)value16; } |
41 | Value eval() const { return (Value)eval16; } |
41 | Value eval() const { return (Value)eval16; } |
42 | Depth depth() const { return (Depth)depth8; } |
42 | Depth depth() const { return (Depth)(depth8 * int(ONE_PLY)); } |
43 | Bound bound() const { return (Bound)(genBound8 & 0x3); } |
43 | Bound bound() const { return (Bound)(genBound8 & 0x3); } |
44 | 44 | ||
45 | void save(Key k, Value v, Bound b, Depth d, Move m, Value ev, uint8_t g) { |
45 | void save(Key k, Value v, Bound b, Depth d, Move m, Value ev, uint8_t g) { |
- | 46 | ||
- | 47 | assert(d / ONE_PLY * ONE_PLY == d); |
|
46 | 48 | ||
47 | // Preserve any existing move for the same position |
49 | // Preserve any existing move for the same position |
48 | if (m || (k >> 48) != key16) |
50 | if (m || (k >> 48) != key16) |
49 | move16 = (uint16_t)m; |
51 | move16 = (uint16_t)m; |
50 | 52 | ||
51 | // Don't overwrite more valuable entries |
53 | // Don't overwrite more valuable entries |
52 | if ( (k >> 48) != key16 |
54 | if ( (k >> 48) != key16 |
53 | || d > depth8 - 4 |
55 | || d / ONE_PLY > depth8 - 4 |
54 | /* || g != (genBound8 & 0xFC) // Matching non-zero keys are already refreshed by probe() */ |
56 | /* || g != (genBound8 & 0xFC) // Matching non-zero keys are already refreshed by probe() */ |
55 | || b == BOUND_EXACT) |
57 | || b == BOUND_EXACT) |
56 | { |
58 | { |
57 | key16 = (uint16_t)(k >> 48); |
59 | key16 = (uint16_t)(k >> 48); |
58 | value16 = (int16_t)v; |
60 | value16 = (int16_t)v; |
59 | eval16 = (int16_t)ev; |
61 | eval16 = (int16_t)ev; |
60 | genBound8 = (uint8_t)(g | b); |
62 | genBound8 = (uint8_t)(g | b); |
61 | depth8 = (int8_t)d; |
63 | depth8 = (int8_t)(d / ONE_PLY); |
62 | } |
64 | } |
63 | } |
65 | } |
64 | 66 | ||
65 | private: |
67 | private: |
66 | friend class TranspositionTable; |
68 | friend class TranspositionTable; |