]> git.sesse.net Git - stockfish/commitdiff
A move needs 17 bits not 19
authorMarco Costalba <mcostalba@gmail.com>
Sun, 29 Mar 2009 16:22:10 +0000 (17:22 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 29 Mar 2009 16:23:41 +0000 (17:23 +0100)
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>
src/tt.cpp
src/tt.h

index c88aef486e3e6f3a755f0f4daee7f7ab04b6e107..5c842db85ea3a552a03cae2bf03a04199003bb39 100644 (file)
@@ -206,5 +206,5 @@ TTEntry::TTEntry() {
 
 TTEntry::TTEntry(Key k, Value v, ValueType t, Depth d, Move m,
                  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)) {}
index 02913efe7f66f0bd1a162de084bdbf1b54cb4a38..31fc1fbce5f5a5801db869c86750028f2aa2c47e 100644 (file)
--- a/src/tt.h
+++ b/src/tt.h
@@ -43,7 +43,7 @@ public:
   TTEntry(Key k, Value v, ValueType t, Depth d, Move m, int generation);
   Key key() const { return key_; }
   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_); }
   ValueType type() const { return ValueType((data >> 20) & 7); }
   int generation() const { return (data >> 23); }