Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential TT indexing issue #221

Merged
merged 4 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ttable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ void StoreHashEntry(const ZobristKey key, const int16_t move, int score, int16_t
}

uint64_t Index(const ZobristKey posKey) {
return (static_cast<uint32_t>(posKey) * static_cast<uint64_t>(HashTable->pTable.size())) >> 32;
#ifdef __SIZEOF_INT128__
return static_cast<uint64_t>(((static_cast<__uint128_t>(posKey) * static_cast<__uint128_t>(HashTable->pTable.size())) >> 64));
#else
return posKey % HashTable->pTable.size();
#endif
}

// prefetches the data in the given address in l1/2 cache in a non blocking way.
Expand Down
2 changes: 1 addition & 1 deletion src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdint>

#define NAME "Alexandria-4.0.11"
#define NAME "Alexandria-4.0.12"

// define bitboard data type
using Bitboard = uint64_t;
Expand Down