Change hashing operator % to &
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user