1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 17:49:35 +00:00

A move needs 17 bits not 19

Fix a bug in the way a move is stored and read in a TT entry.
We use a mask of 19 bits insteaad of 17 so that the last
two bits in the TT entry end up to be random data.

This bug will bite us when we will use these two until now
unused bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-03-29 17:22:10 +01:00
parent 941f4e1643
commit 9e44a6dba9
2 changed files with 2 additions and 2 deletions

View file

@ -206,5 +206,5 @@ TTEntry::TTEntry() {
TTEntry::TTEntry(Key k, Value v, ValueType t, Depth d, Move m, TTEntry::TTEntry(Key k, Value v, ValueType t, Depth d, Move m,
int generation) : int generation) :
key_ (k), data((m & 0x7FFFF) | (t << 20) | (generation << 23)), key_ (k), data((m & 0x1FFFF) | (t << 20) | (generation << 23)),
value_(int16_t(v)), depth_(int16_t(d)) {} value_(int16_t(v)), depth_(int16_t(d)) {}

View file

@ -43,7 +43,7 @@ public:
TTEntry(Key k, Value v, ValueType t, Depth d, Move m, int generation); TTEntry(Key k, Value v, ValueType t, Depth d, Move m, int generation);
Key key() const { return key_; } Key key() const { return key_; }
Depth depth() const { return Depth(depth_); } Depth depth() const { return Depth(depth_); }
Move move() const { return Move(data & 0x7FFFF); } Move move() const { return Move(data & 0x1FFFF); }
Value value() const { return Value(value_); } Value value() const { return Value(value_); }
ValueType type() const { return ValueType((data >> 20) & 7); } ValueType type() const { return ValueType((data >> 20) & 7); }
int generation() const { return (data >> 23); } int generation() const { return (data >> 23); }