From: Marco Costalba Date: Thu, 2 May 2013 07:35:52 +0000 (+0200) Subject: Another take at TT alignment X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=d44ac0a4850f389ee2fdb8812104150c323d9ec2;ds=sidebyside Another take at TT alignment This time revert to original version but using uintptr_t instead of size_t Suggested by Lucas. No functional change. --- diff --git a/src/tt.cpp b/src/tt.cpp index 271b98b7..c6b294a0 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -50,8 +50,7 @@ void TranspositionTable::set_size(size_t mbSize) { exit(EXIT_FAILURE); } - // Align table start address to a cache line - for (char* c = (char*)mem; unsigned(table = (TTEntry*)(c)) % CACHE_LINE_SIZE; c++) {} + table = (TTEntry*)((uintptr_t(mem) + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)); clear(); // Operator new is not guaranteed to initialize memory to zero }