From f83f3a5b8ff88db2df4b819db0cd3210dfd97833 Mon Sep 17 00:00:00 2001 From: rektdie Date: Sat, 10 May 2025 23:47:46 +0200 Subject: [PATCH] storing shorter hashKey in TTEntry | bench 1132682 --- source/nnue.h | 2 +- source/tt.cpp | 4 ++-- source/tt.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/nnue.h b/source/nnue.h index 3e977af..5fa6b9f 100644 --- a/source/nnue.h +++ b/source/nnue.h @@ -8,7 +8,7 @@ class Board; #ifdef __AVX512F__ -constexpr usize ALIGNMENT = 64; +constexpr size_t ALIGNMENT = 64; #else constexpr size_t ALIGNMENT = 32; #endif diff --git a/source/tt.cpp b/source/tt.cpp index 6f6b638..deed40d 100644 --- a/source/tt.cpp +++ b/source/tt.cpp @@ -3,7 +3,7 @@ SearchResults TTable::ReadEntry(U64 &hashKey, int depth, int alpha, int beta) { TTEntry *current = &table[hashKey % table.size()]; - if (current->hashKey == hashKey) { + if (current->hashKey == static_cast(hashKey)) { if (current->depth >= depth) { if (current->nodeType == PV){ return {current->score, current->bestMove}; @@ -22,7 +22,7 @@ SearchResults TTable::ReadEntry(U64 &hashKey, int depth, int alpha, int beta) { void TTable::WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove) { TTEntry *current = &table[hashKey % table.size()]; - current->hashKey = hashKey; + current->hashKey = static_cast(hashKey); current->nodeType = nodeType; current->score = score; current->depth = depth; diff --git a/source/tt.h b/source/tt.h index 088faaf..19cc03a 100644 --- a/source/tt.h +++ b/source/tt.h @@ -21,13 +21,13 @@ public: class TTEntry { public: - U64 hashKey = 0; + uint16_t hashKey = 0; int depth = 0; int score = 0; int nodeType = 0; Move bestMove = Move(); - operator U64() { + operator uint16_t() { return hashKey; } };