From d44ac0a4850f389ee2fdb8812104150c323d9ec2 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Thu, 2 May 2013 09:35:52 +0200 Subject: [PATCH] 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. --- src/tt.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 } -- 2.39.2