diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-15 14:28:35 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-15 14:28:35 +0530 |
| commit | f97ea63ac29c08530b1aaff89277262b44ef7a11 (patch) | |
| tree | 2534d597b2356de9dda0412665cf8ba06870526c /src/main.c | |
| parent | 2bf47937bcc5cd29cf8081f922b7615b7e57ed57 (diff) | |
phase A
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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: |
