From f97ea63ac29c08530b1aaff89277262b44ef7a11 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Sat, 15 Aug 2026 14:28:35 +0530 Subject: phase A --- src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 5ece480..61a3850 100644 --- a/src/main.c +++ b/src/main.c @@ -30,6 +30,14 @@ int main(int argc, char** argv) { threads_init(&engine_threads, ipc_state.uci_state.threads); threads_link(&engine_threads, &ipc_state); + // initialise the transposition table from the UCI "Hash" option (in MiB). + // pick the smallest power of two (>= 2^4) that fills at least that much memory. + size_t hash_mb = (size_t)ipc_state.uci_state.hash; + u64 buckets = (hash_mb * 1024 * 1024) / sizeof(tbucket_t); + int hash_log2 = 4; + while ((1ULL << (hash_log2 + 1)) <= buckets && hash_log2 < 30) hash_log2++; + ttable_init(&engine_threads.ttable, hash_log2); + engine_messages_init(&ipc_state.engine_messages); goto skip_refresh; waiting_for_go: -- cgit v1.2.3