This commit is contained in:
2024-06-20 05:36:42 +02:00
parent f530a13481
commit 242b501404
6 changed files with 85 additions and 26 deletions

View File

@@ -191,7 +191,6 @@ int tt_create(s32 sizemb)
if (sizemb <= 0)
sizemb = HASH_SIZE_DEFAULT;
sizemb = clamp(sizemb, HASH_SIZE_MIN, HASH_SIZE_MAX);
//printf("-> %'6d ", sizemb);
bytes = sizemb * 1024ull * 1024ull; /* bytes wanted */
target_nbuckets = bytes / sizeof(bucket_t); /* target buckets */
@@ -199,7 +198,7 @@ int tt_create(s32 sizemb)
nbits = msb64(target_nbuckets); /* adjust to power of 2 */
if (hash_tt.nbits != nbits) {
if (hash_tt.nbits)
if (hash_tt.keys)
tt_delete();
hash_tt.nbits = nbits;

View File

@@ -21,7 +21,7 @@
#define ENTRIES_PER_BUCKET 4 /* buckets per hash table entry */
#define HASH_SIZE_DEFAULT 32 /* default: 32Mb */
#define HASH_SIZE_MIN 4
#define HASH_SIZE_MIN 1
#define HASH_SIZE_MAX 32768 /* 32Gb */
#define TT_MISS NULL

View File

@@ -70,7 +70,7 @@ u64 perft(pos_t *pos, int depth, int ply, bool output)
movelist_t movelist2;
pos_set_checkers_pinners_blockers(pos);
subnodes = pos_legal(pos, pos_gen_pseudo(pos, &movelist2))->nmoves;
} else if (ply >= 4) {
} else if (ply >= 3) {
hentry_t *entry = tt_probe_perft(pos->key, depth);
if (entry != TT_MISS) {
subnodes = HASH_PERFT_VAL(entry->data);