Change hashing operator % to &

This commit is contained in:
stefiosif
2025-04-04 18:00:55 +03:00
parent 6b009383fe
commit 5966b1984c

View File

@@ -25,12 +25,12 @@ impl TranspositionTable {
pub fn lookup(&self, zobrist_hash: ZobristHash) -> Option<TTEntry> {
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);
}
}