diff --git a/src/search/transposition_table.rs b/src/search/transposition_table.rs index dec0f20..06642c9 100644 --- a/src/search/transposition_table.rs +++ b/src/search/transposition_table.rs @@ -25,12 +25,12 @@ impl TranspositionTable { pub fn lookup(&self, zobrist_hash: ZobristHash) -> Option { self.positions - .get((zobrist_hash.0 % self.size) as usize) + .get((zobrist_hash.0 & (self.size - 1)) as usize) .and_then(|entry| *entry) } pub fn insert(&mut self, entry: TTEntry) { - let idx = (entry.hash.0 % self.size) as usize; + let idx = (entry.hash.0 & (self.size - 1)) as usize; self.positions[idx] = Some(entry); } }